Sponsors: Michael Fertik - Best JAVA Web hosting Company & 30% off


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-07-2010, 11:42 PM
Member
 
Join Date: Feb 2010
Posts: 2
Rep Power: 0
darrell22 is on a distinguished road
Question 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!
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 02-08-2010, 07:45 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
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
Code:
C:\Program Files\a\b\c;C:\Program Files\d\e\f
use
Code:
"C:\Program Files\a\b\c";"C:\Program Files\d\e\f"
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-08-2010, 10:53 AM
Member
 
Join Date: Dec 2009
Posts: 88
Rep Power: 0
coltragon is on a distinguished road
Default
try using Netbeans IDE, i got a lot of problems with classpath aswell and netbean sjust does it right
__________________
Beginner in Java Programming, Please don't trust my anwsers blind please
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 02-08-2010, 10:59 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
Originally Posted by coltragon View Post
try using Netbeans IDE, i got a lot of problems with classpath aswell and netbean sjust does it right
You should be able to do it yourself, however. If you do not understand how to, and cannot, do it manually, you will be lost the first time you do not have that IDE. You will even be lost when you use other IDEs.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 02-09-2010, 06:46 AM
Member
 
Join Date: Feb 2010
Posts: 2
Rep Power: 0
darrell22 is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 02-09-2010, 08:27 AM
Senior Member
 
Join Date: Jun 2008
Posts: 1,622
Rep Power: 4
masijade is on a distinguished road
Default
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.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Tags
javac invalid flag

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EJB invokation failing in jdk1.5.0_23 but works in jdk1.6.0 randle169 Enterprise JavaBeans 0 01-28-2010 09:09 AM
Error : Invalid path, \bin\javac.exe -classpath Ed JCreator 3 08-14-2009 12:57 PM
JNLP - Swing application compiled in jdk1.5 not working in jdk1.6 mahendra.athneria AWT / Swing 4 01-20-2009 08:27 PM
I am using Jdk1.3. I am not able to import Scanneer class in my program. tabrez_k81 New To Java 4 12-29-2008 02:20 PM
Error :Invalid path, C:\Program Files\Java\j2re1.4.2_06\bin\javac.exe silvia New To Java 2 07-30-2007 08:55 AM


Java Forums is supported by the best jsp hosting.

All times are GMT +2. The time now is 05:24 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org