Compiling problem.

58 views
Skip to first unread message

zodoz

unread,
Mar 3, 2009, 1:58:16 AM3/3/09
to Clojure
I'm just larning Clojure and have been able to figure out everything
so far via trial-and-error. However, I cannot for the LIFE of me
figure out how to compile anything. I have tried every possible setup
I can think of and I all I have is a sneaking suspicion that its a
Vista issue.

Below I have listed my setup to make this as complete a question as I
can, however the error I am getting is "java.io.IOException: The
system cannot find the path specified (test.clj:1)" so I don't expect
the problem to be with how my filesystem is setup but rather with
classpaths. Any suggestions and thanks in advance?

I have a simple extraction of the latest files, inside the "clojure"
folder I have renamed the orrigonal "src" folder to "srcb" so that I
can single out only my code. I have a test.clj file whose contents
are (basically the example given on the main site):
(ns test
(:gen-class))

(defn -main
[gre]
(println (str "Hello " gre))

I have the following folder/file setup:
clojure/
->clojure/classes
->clojure/src
-->clojure/src/test
--->clojure/src/test/test.clj
-->clojure/src/test.clj
->clojure/test.clj

Each of these test.clj files have their own ns as either "test" or
"test.test" depending on where they are in the filesystem. The
exception is the one in the clojure folder, this one I have tested it
with both.

Mark Volkmann

unread,
Mar 3, 2009, 7:41:26 AM3/3/09
to clo...@googlegroups.com

The step-by-step instructions at
http://www.ociweb.com/mark/clojure/article.html#Compiling might help,
especially step #8 related to setting the classpath.

--
R. Mark Volkmann
Object Computing, Inc.

zodoz

unread,
Mar 3, 2009, 10:44:20 AM3/3/09
to Clojure
*sigh*... Still no joy. I've looked around for how to use the
command and I finally got it to stop giving me directory permission
errors, but Java still does not seem to be liking it. I am now
running it with "java -classpath .;src;classes -jar clojure.jar", but
when I run (compile 'test) or (compile 'test.test) I still get
"java.io.IOException: The system cannot find the path specified
(test.clj:1)"... Am I running the command java command wrong?

P.S. I tried the java command with "src" only and "." only as well.

On Mar 3, 6:41 am, Mark Volkmann <r.mark.volkm...@gmail.com> wrote:
> The step-by-step instructions athttp://www.ociweb.com/mark/clojure/article.html#Compilingmight help,

Laurent PETIT

unread,
Mar 3, 2009, 10:49:05 AM3/3/09
to clo...@googlegroups.com
You cannot have both a classpath full of jars and directories (via the -cp option) and run directly from a jar.

Try java -classpath .;src;classes;clojure.jar clojure.main" instead

(http://clojure.org/repl_and_main)

2009/3/3 zodoz <zdz....@gmail.com>

zodoz

unread,
Mar 3, 2009, 11:56:28 AM3/3/09
to Clojure
Same thing. I even tried putting (compile 'test.test) in the src/test/
test.clj file and loading it with "java -
classpath .;src;classes;clojure.jar clojure.main src/test/test.clj".
If it helps, the full error I am getting now is:

java.io.IOException: The system cannot find the path specified
(test.clj:1)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4113)
at clojure.lang.Compiler.analyze(Compiler.java:3935)
at clojure.lang.Compiler.analyze(Compiler.java:3908)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:
3613)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4106)
at clojure.lang.Compiler.analyze(Compiler.java:3935)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4094)
at clojure.lang.Compiler.analyze(Compiler.java:3935)
at clojure.lang.Compiler.analyze(Compiler.java:3908)
at clojure.lang.Compiler.compile(Compiler.java:4559)
at clojure.lang.RT.compile(RT.java:362)
at clojure.lang.RT.load(RT.java:404)
at clojure.lang.RT.load(RT.java:376)
at clojure.core$load__4557$fn__4559.invoke(core.clj:3427)
at clojure.core$load__4557.doInvoke(core.clj:3426)
at clojure.lang.RestFn.invoke(RestFn.java:413)
at clojure.core$load_one__4520.invoke(core.clj:3271)
at clojure.core$compile__4563$fn__4565.invoke(core.clj:3437)
at clojure.core$compile__4563.invoke(core.clj:3436)
at test.test$eval__7.invoke(test.clj:8)
at clojure.lang.Compiler.eval(Compiler.java:4142)
at clojure.lang.Compiler.load(Compiler.java:4470)
at clojure.lang.Compiler.loadFile(Compiler.java:4437)
at clojure.main$load_script__5177.invoke(main.clj:117)
at clojure.main$script_opt__5209.invoke(main.clj:163)
at clojure.main$_main__5222.doInvoke(main.clj:227)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.main.main(Unknown Source)
Caused by: java.io.IOException: The system cannot find the path
specified
at java.io.WinNTFileSystem.createFileExclusively(Native
Method)
at java.io.File.createNewFile(File.java:883)
at clojure.lang.Compiler.writeClassFile(Compiler.java:4498)
at clojure.core$gen_class__5126.doInvoke(genclass.clj:547)
at clojure.lang.RestFn.invoke(RestFn.java:498)
at clojure.lang.Var.invoke(Var.java:347)
at clojure.lang.AFn.applyToHelper(AFn.java:198)
at clojure.lang.Var.applyTo(Var.java:444)
at clojure.lang.Compiler.macroexpand1(Compiler.java:4025)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:4092)
... 27 more

On Mar 3, 9:49 am, Laurent PETIT <laurent.pe...@gmail.com> wrote:
> You cannot have both a classpath full of jars and directories (via the -cp
> option) and run directly from a jar.
>
> Try java -classpath .;src;classes;clojure.jar clojure.main" instead
>
> (http://clojure.org/repl_and_main)
>
> 2009/3/3 zodoz <zdz.r...@gmail.com>

zodoz

unread,
Mar 3, 2009, 4:22:56 PM3/3/09
to Clojure
I found the solution (though I'm still in the process of understanding
why it works):

java -cp clojure.jar;.\src;.\classes clojure.lang.Repl
user=> (compile 'test.test)

Achim Passen

unread,
Mar 3, 2009, 5:01:01 PM3/3/09
to clo...@googlegroups.com
Hi!

Are you using the release version from clojure.org? I remember this
one having a strange *compile-path* default when started as
clojure.main (something like "/Users/rich/..."), but defaulting to
"classes" when started as clojure.lang.Repl ...

Kind regards,
achim
Reply all
Reply to author
Forward
0 new messages