Re: classpath and require

2010-06-19 Thread rzeze...@gmail.com


On Jun 18, 5:00 pm, Mohammad Khan beepl...@gmail.com wrote:
 C:\Projects.cljjava -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.cljecho %CLASSPATH%
 C:\Projects.clj;C:\clojure;C:\clojure-contrib
 C:\Projects.cljdir examples\introduction.clj
  Volume in drive C is xxx
  Volume Serial Number is -
  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

You're overriding your %CLASSPATH% variable with your -cp argument
[1].

Try starting your REPL with the following.

java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure
\clojure.jar;C:\Projects.clj clojure.main

1: http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#options

-- 
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


Re: classpath and require

2010-06-19 Thread Rasmus Svensson
2010/6/18 Mohammad Khan beepl...@gmail.com

 C:\Projects.cljjava -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.cljecho %CLASSPATH%
 C:\Projects.clj;C:\clojure;C:\clojure-contrib
 C:\Projects.cljdir examples\introduction.clj
  Volume in drive C is xxx
  Volume Serial Number is -
  Directory of C:\Projects.clj\examples

 06/18/2010  04:52 PM40 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

Re: classpath and require

2010-06-19 Thread Rob Lachlan
I was wondering whether putting a dot in a directory on the classpath
makes a difference.  On OS X, the answer is no.  Unfortunately, I
don't have a windows machine, so I can't check for certain what the
situation is there.

Another issue: I ignored case-sensitivity in my answer above.  Are
windows paths ever case-sensitive?  (silly question, I know, but I
haven't worked with windows in a while.)  Another question:

If you run:

java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure
\clojure.jar;c:\projects.clj\examples clojure.main

can you then just do (require 'introduction)

And do try it with quotes around the classpath.  The dot in
projects.clj might be like a space in that it could lead to a parsing
error without quotes.

Good luck
Rob

On Jun 19, 1:58 am, Rasmus Svensson r...@lysator.liu.se wrote:
 2010/6/18 Mohammad Khan beepl...@gmail.com





  C:\Projects.cljjava -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.cljecho %CLASSPATH%
  C:\Projects.clj;C:\clojure;C:\clojure-contrib
  C:\Projects.cljdir examples\introduction.clj
   Volume in drive C is xxx
   Volume Serial Number is -
   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


Re: classpath and require

2010-06-19 Thread Michael Wood
On 19 June 2010 17:46, Rob Lachlan robertlach...@gmail.com wrote:
 I was wondering whether putting a dot in a directory on the classpath
 makes a difference.  On OS X, the answer is no.  Unfortunately, I
 don't have a windows machine, so I can't check for certain what the
 situation is there.

No, rzezeski found the problem.

Mohammad's CLASSPATH environment variable was correct, but he was
overriding that by using:
java -cp clojure-contrib.jar;clojure.jar clojure.main

-- 
Michael Wood esiot...@gmail.com

-- 
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


Re: classpath and require

2010-06-19 Thread Mohammad Khan
Correction, it worked..


On Fri, Jun 18, 2010 at 6:19 PM, Mohammad Khan beepl...@gmail.com wrote:

 No, it didn't work.. what else I could be missing..


 On Fri, Jun 18, 2010 at 5:56 PM, Rob Lachlan robertlach...@gmail.comwrote:

 Whoops, that should read:

 java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure
 \clojure.jar;c:
 \projects.clj clojure.main

 On Jun 18, 2:51 pm, Rob Lachlan robertlach...@gmail.com wrote:
  have you tried starting with:
 
  c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c:
  \projects.clj clojure.main
 
  On Jun 18, 2:00 pm, Mohammad Khan beepl...@gmail.com wrote:
 
 
 
   C:\Projects.cljjava -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.cljecho %CLASSPATH%
   C:\Projects.clj;C:\clojure;C:\clojure-contrib
   C:\Projects.cljdir examples\introduction.clj
Volume in drive C is xxx
Volume Serial Number is -
Directory of C:\Projects.clj\examples
 
   06/18/2010  04:52 PM40 introduction.clj
  1 File(s) 40 bytes
  0 Dir(s)  xx,xxx,xxx bytes free
 
   C:\Projects.clj

 --
 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en




-- 
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

Re: classpath and require

2010-06-19 Thread Mohammad Khan
Yes, exactly it was, also at some point I was trying examples/introduction
(ruby's require like statement) instead of examples.introduction which all
together made me lost. Thanks everybody for your help.

Thanks,
Mohammad


On Sat, Jun 19, 2010 at 11:59 AM, Michael Wood esiot...@gmail.com wrote:

 On 19 June 2010 17:46, Rob Lachlan robertlach...@gmail.com wrote:
  I was wondering whether putting a dot in a directory on the classpath
  makes a difference.  On OS X, the answer is no.  Unfortunately, I
  don't have a windows machine, so I can't check for certain what the
  situation is there.

 No, rzezeski found the problem.

 Mohammad's CLASSPATH environment variable was correct, but he was
 overriding that by using:
 java -cp clojure-contrib.jar;clojure.jar clojure.main

 --
 Michael Wood esiot...@gmail.com

 --
 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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

Re: classpath and require

2010-06-18 Thread Rob Lachlan
have you tried starting with:

c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c:
\projects.clj clojure.main


On Jun 18, 2:00 pm, Mohammad Khan beepl...@gmail.com wrote:
 C:\Projects.cljjava -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.cljecho %CLASSPATH%
 C:\Projects.clj;C:\clojure;C:\clojure-contrib
 C:\Projects.cljdir examples\introduction.clj
  Volume in drive C is xxx
  Volume Serial Number is -
  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

-- 
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


Re: classpath and require

2010-06-18 Thread Rob Lachlan
Whoops, that should read:

java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure
\clojure.jar;c:
\projects.clj clojure.main

On Jun 18, 2:51 pm, Rob Lachlan robertlach...@gmail.com wrote:
 have you tried starting with:

 c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c:
 \projects.clj clojure.main

 On Jun 18, 2:00 pm, Mohammad Khan beepl...@gmail.com wrote:



  C:\Projects.cljjava -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.cljecho %CLASSPATH%
  C:\Projects.clj;C:\clojure;C:\clojure-contrib
  C:\Projects.cljdir examples\introduction.clj
   Volume in drive C is xxx
   Volume Serial Number is -
   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

-- 
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


Re: classpath and require

2010-06-18 Thread Mohammad Khan
No, it didn't work.. what else I could be missing..

On Fri, Jun 18, 2010 at 5:56 PM, Rob Lachlan robertlach...@gmail.comwrote:

 Whoops, that should read:

 java -cp c:\clojure-contrib\clojure-contrib.jar;c:\clojure
 \clojure.jar;c:
 \projects.clj clojure.main

 On Jun 18, 2:51 pm, Rob Lachlan robertlach...@gmail.com wrote:
  have you tried starting with:
 
  c:\clojure-contrib\clojure-contrib.jar;c:\clojure\clojure.jar;c:
  \projects.clj clojure.main
 
  On Jun 18, 2:00 pm, Mohammad Khan beepl...@gmail.com wrote:
 
 
 
   C:\Projects.cljjava -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.cljecho %CLASSPATH%
   C:\Projects.clj;C:\clojure;C:\clojure-contrib
   C:\Projects.cljdir examples\introduction.clj
Volume in drive C is xxx
Volume Serial Number is -
Directory of C:\Projects.clj\examples
 
   06/18/2010  04:52 PM40 introduction.clj
  1 File(s) 40 bytes
  0 Dir(s)  xx,xxx,xxx bytes free
 
   C:\Projects.clj

 --
 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.comclojure%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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