Error formatting macro: pagetree: java.lang.NullPointerException

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added "Running" section


  1. What's a JAR?
    JAR is an acronym for "Java Archive." It's the standard format for distributing Java code, and also Clojure code. The format is basically just a ZIP file with some extra metadata. The Java Development Kit (JDK) includes the "jar" command-line program to manipulate JAR files, but typically this task will be handled for you by a build tool such as Ant or Maven.
  2. What's the classpath?
    The classpath is a list of directories and JAR files where the Java runtime searches for code to load. Java does not have a system-wide library directory like Perl, Ruby, or Python. Instead, each program has its own classpath, supplied as the "-cp" command-line argument to the "java" executable. On Unix, Linux, and OSX, entries in the classpath are separated by the colon character; on Windows, it's a semicolon. In order to use a Java class or Clojure namespace in your program, that class or namespace must be "on the classpath," that is, inside a directory or JAR file listed in the classpath.
  3. How can I change the classpath of a running program?
    You can't. The classpath cannot be changed after a program has started, except by very advanced Java programming. Some IDEs and application servers provide this functionality.


  1. How do I run Clojure code in a file?

    java -cp /path/to/the/clojure.jar clojure.main /path/to/your/code.clj
  2. How do I start a Clojure REPL (console)?

    java -cp /path/to/the/clojure.jar clojure.main


  1. Why can't I require/use my namespace ?
    Because here, your namespace is loaded from the disk. For good interop with JVM features, Clojure does some "munging/unmunging" of names depending of them having to be "consumed" by the "clojure side" or the "jvm side" of the equation. So a "_" in a namespace "folder name/file name" has to correspond to a "-" in the namespace name. Check that your namespace on disk is in "project_name/foo.clj", while your namespace is declared as "" (e.g. in a (ns directive).