2010/6/18 Mohammad Khan <beepl...@gmail.com>

> C:\Projects.clj>java -cp
> c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar clojure.main
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (require 'examples.introduction)
> java.io.FileNotFoundException: Could not locate
> examples/introduction__init.class or examples/introduction.clj on
> classpath:  (NO_SOURCE_FILE:0)
> user=>
>
> C:\Projects.clj>echo %CLASSPATH%
> C:\Projects.clj;C:\clojure;C:\clojure-contrib
> C:\Projects.clj>dir examples\introduction.clj
>  Volume in drive C is xxx
>  Volume Serial Number is xxxx-xxxx
>  Directory of C:\Projects.clj\examples
>
> 06/18/2010  04:52 PM                40 introduction.clj
>                1 File(s)             40 bytes
>                0 Dir(s)  xx,xxx,xxx bytes free
>
> C:\Projects.clj>
>

Hello!

To me it looks like you have gotten the most things right. As I see you
understand, you must have clojure, clojure-contrib and the source on the
class path. However, how these are specified can be a bit tricky. There are
basically two cases: directories and jar files.

When using jar files, the jar file itself must be in the class path, not the
directory which contains it. In our case, the entries would be
c:\clojure\clojure.jar and c:\clojure-contrib\clojure-contrib.jar, just as
you wrote.

When using folders with clojure source files or ahead-of-time compiled
classes, the directory that contains the folder that represents the topmost
component of the namespace. For example, in your case the namespace
examples.introduction is stored in the file
C:\Projects.clj\examples\introduction.clj so the directory C:\Projects.clj\
should be inlcuded in the class path.

When Clojure loads the namespace examples.introduction, it will try to find
examples\introduction.clj in every directory (or jar file) in the class
path. The error you got is an indication that no matching file could be
found.

On windows, the paths are delimited with semicolons, but on most other
platforms colons are used. That's why most examples will use colons. If the
paths in the class path contains spaces or other special characters, you
should enclose the thing in spaces, like this:

java -cp "C:\path one\;C:\path two\" clojure.main

>From what I can tell, Rob's example should work. I'm not sure if a trailing
backslash is required for directories, but you could try with and without it
to see if it makes any difference. If that doesn't work, try renaming
projects.clj to something without a dot in it. Also, look carefully for
typos...

I hope this helps...

// raek

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to