Compiling unusual Java class with classpath
Hi I'm trying to compile a java file and having a lot of problems accessing all the directories required. For workflow reasons, I'd like to keep all directories as they are.
I need to compile the file:
C:\Users\cron\Documents\My Dropbox\Leeds\VAplayer\program\VAreceiver\javatest.java
So that it has access to this class directory:
C:\Program Files\Cycling '74\Max 5.0\java-doc\api\com\cycling74\max
And the outputted class file ends up here:
C:\Program Files\Cycling '74\Max 5.0\Cycling '74\java\classes
This is the example provided by Cycling 74 help files:
javac -classpath "\Program Files\Common Files\Cycling '74\java\lib\max.jar" MyClass.java
I'm not sure what max.jar is? Anyway, when I run java
c on my machine I get an error saying the command is not recognized so I'm trying to use the full path to javac.exe
. Here's what I have so far:
C:\Program Files\Java\jdk1.6.0_24\bin\javac.exe" -classpath "\Prog开发者_StackOverflow社区ram Files\Common Files\Cycling '74\java\lib\max.jar" "C:\Users\cron\Documents\My Dropbox\Leeds\VAplayer\program\VAreceiver\javatest.java
And here's the error I get:
C:\Users\cron\Documents\My Dropbox\Leeds\VAplayer\program\VAreceiver\javatest.java:1: package com.cycling74.max does not exist
import com.cycling74.max
Obviously it's not seeing the classpath. Anyone know how I can fix this?
"C:\Program Files\Java\jdk1.6.0_24\bin\javac.exe" \
-classpath "\Program Files\Common Files\Cycling '74\java\lib\max.jar";"C:\Program Files\Cycling '74\Max 5.0\java-doc\api\com\cycling74\max" \
-d "C:\Program Files\Cycling '74\Max 5.0\Cycling '74\java\classes" \
"C:\Users\cron\Documents\My Dropbox\Leeds\VAplayer\program\VAreceiver\javatest.java"
You need to put the second directory after the jar separated by a ;
(or :
on UNIX) and use -d
to specify the output directory.
If you need access to the class directory at C:\Program Files\Cycling '74\Max 5.0\java-doc\api\com\cycling74\max
, then you need to add this directory to the class path.
Here's a classpath that includes both max.jar
and the other directory:
-classpath "C:\Program Files\Common Files\Cycling '74\java\lib\max.jar;C:\Program Files\Cycling '74\Max 5.0\java-doc\api"
If you want to say where the class files should end up, use the switch -d.
Here's the complete compile command:
"C:\Program Files\Java\jdk1.6.0_24\bin\javac.exe" -classpath "C:\Program Files\Common Files\Cycling '74\java\lib\max.jar;C:\Program Files\Cycling '74\Max 5.0\java-doc\api" -d "C:\Program Files\Cycling '74\Max 5.0\Cycling '74\java\classes" "C:\Users\cron\Documents\My Dropbox\Leeds\VAplayer\program\VAreceiver\javatest.java"
Thanks for the replies guys! I got it sorted. it turns out that max.jar file has been moved to another directory on the latest version of MaxMSP. If anyone else is having trouble with this, the final command is:
"C:\Program Files\Java\jdk1.6.0_24\bin\javac.exe" -classpath "C:\Program Files\Cycling '74\Max 5.0\Cycling '74\java\lib\max.jar" -d "C:\Program Files\Cycling '74\Max 5.0\Cycling '74\java\classes" "C:\Users\cron\Documents\My Dropbox\Leeds\VAplayer\program\VAreceiver\javatest.java"
Thanks again chaps!
精彩评论