Results 1 to 6 of 6
- 02-07-2010, 11:42 PM #1
Member
- Join Date
- Feb 2010
- Posts
- 4
- Rep Power
- 0
javac: invalid flag: Files\Java\jdk1.6.0_18;C:\Program
Dear Experts,
Today, on Windows xp, I installed:
jdk-6u18-windows-i586.exe
I'm trying to do the simple business
of now running a simple program. The program
code DID work/run before on my old machine.
So, it's not the code.
I've changed the path, classpath, and java_path.
The symptom is:
cd C:\Program Files\Java\jdk1.6.0_18\bin
javac -classpath %classpath% C:\Notes\java\code2\Car.java
javac: invalid flag: Files\Java\jdk1.6.0_18;C:\Program
Usage: javac <options> <source files>
use -help for a list of possible options
javac -classpath %classpath%:. Car.java
javac: invalid flag: Files\Java\jdk1.6.0_18;C:\Program
Usage: javac <options> <source files>
use -help for a list of possible options
Here are the environment variables:
Path=
C:\Program Files\Java\jdk1.6.0_18\bin;C:\WINDOWS\system32;C:\ WINDOWS;C:\WINDOWS\System32\Wbem;
C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Sonic\MyDVD;C:\cygwin\bin;C:\cygwin\usr\bin; C:
\cygwin\usr\sbin;C:\cygwin\sbin
CLASSPATH=
.;C:\Program Files\Java\jdk1.6.0_18;C:\Program Files\Java\jdk1.6.0_18\bin;C:\Program Files
\Java\jdk1.6.0_18\lib;C:\Program Files\Java\jdk1.6.0_18\\src.zip;C:\Program Files\Java\jdk1.6.0_18\l
ib\dt.jar;C:\Program Files\Java\jdk1.6.0_18\demo\jfc\SwingApplet\SwingA pplet.jar;C:\Program Files\Qu
ickTime\QTSystem\QTJava.zip
java_path is:
C:\Program Files\Java\jdk1.6.0_18
Does anyone know the secret to fix this???
Could it have something to do with the blanks in
C:\program files
???
Sorry for the seemingly dumb questions.
But this kind of nonsense gets me every time.
Thanks a lot!
- 02-08-2010, 07:45 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Not a Java problem. That is a problem with the Windows command shell and the fact that you have spaces in the directory names. Place quotes around those arguments I.E. instead of
useJava Code:C:\Program Files\a\b\c;C:\Program Files\d\e\f
Java Code:"C:\Program Files\a\b\c";"C:\Program Files\d\e\f"
- 02-08-2010, 10:53 AM #3
Senior Member
- Join Date
- Dec 2009
- Posts
- 104
- Rep Power
- 0
try using Netbeans IDE, i got a lot of problems with classpath aswell and netbean sjust does it right :D
Beginner in Java Programming, Please don't trust my anwsers blind please :D
- 02-08-2010, 10:59 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 02-09-2010, 06:46 AM #5
Member
- Join Date
- Feb 2010
- Posts
- 4
- Rep Power
- 0
Thanks for your responses.
I noticed that JAVA_PATH did not take.
Reset JAVA_PATH to:
JAVA_PATH=C:\Program Files\Java\jdk1.6.0_18
And there was a blank in one of the other paths
around one of the ";" I removed it.
But still no quotes. Now I have:
CLASSPATH=.;C:\Program Files\Java\jdk1.6.0_18;C:\Program Files\Java\jdk1.6.0_18\bin;C:\Program Files
\Java\jdk1.6.0_18\lib;C:\Program Files\Java\jdk1.6.0_18\\src.zip;C:\Program Files\Java\jdk1.6.0_18\l
ib\dt.jar;C:\Program Files\Java\jdk1.6.0_18\demo\jfc\SwingApplet\SwingA pplet.jar;C:\Program Files\Qu
ickTime\QTSystem\QTJava.zip
Path=C:\Program Files\Java\jdk1.6.0_18\bin;C:\WINDOWS\system32;C:\ WINDOWS;C:\WINDOWS\System32\Wbem;
C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Sonic\MyDVD;C:\cygwin\bin;C:\cygwin\usr\bin; C:
\cygwin\usr\sbin;C:\cygwin\sbin
Now it seems that the old syntax no longer works. Surprise!
Before I used %classpath%. Now that seems to cause issues.
At least if I have already defined the environment variable: classpath
cd C:\Notes\java\code2
javac -classpath %classpath%:. Car.java
javac: invalid flag: Files\Java\jdk1.6.0_18;C:\Program
Usage: javac <options> <source files>
use -help for a list of possible options
javac Car.java
- seems to work.
C:\notes\java\code2>java CarTest
- works.
I hope this will be all there is to worry about.
- 02-09-2010, 08:27 AM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Stick with your thread on Sun. You are getting more detailed advice there. Not that you are actually paying attention to any of the advice you're getting.
Similar Threads
-
EJB invokation failing in jdk1.5.0_23 but works in jdk1.6.0
By randle169 in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 01-28-2010, 09:09 AM -
Error : Invalid path, \bin\javac.exe -classpath
By Ed in forum JCreatorReplies: 3Last Post: 08-14-2009, 12:57 PM -
JNLP - Swing application compiled in jdk1.5 not working in jdk1.6
By mahendra.athneria in forum AWT / SwingReplies: 4Last Post: 01-20-2009, 08:27 PM -
I am using Jdk1.3. I am not able to import Scanneer class in my program.
By tabrez_k81 in forum New To JavaReplies: 4Last Post: 12-29-2008, 02:20 PM -
Error :Invalid path, C:\Program Files\Java\j2re1.4.2_06\bin\javac.exe
By silvia in forum New To JavaReplies: 2Last Post: 07-30-2007, 08:55 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks