Results 1 to 6 of 6
  1. #1
    darrell22 is offline Member
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    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!

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    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
    Java Code:
    C:\Program Files\a\b\c;C:\Program Files\d\e\f
    use
    Java Code:
    "C:\Program Files\a\b\c";"C:\Program Files\d\e\f"

  3. #3
    coltragon is offline Senior Member
    Join Date
    Dec 2009
    Posts
    104
    Rep Power
    0

    Default

    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

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote 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 :D
    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.

  5. #5
    darrell22 is offline Member
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    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.

  6. #6
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    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.

Similar Threads

  1. EJB invokation failing in jdk1.5.0_23 but works in jdk1.6.0
    By randle169 in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 01-28-2010, 09:09 AM
  2. Replies: 3
    Last Post: 08-14-2009, 12:57 PM
  3. JNLP - Swing application compiled in jdk1.5 not working in jdk1.6
    By mahendra.athneria in forum AWT / Swing
    Replies: 4
    Last Post: 01-20-2009, 08:27 PM
  4. Replies: 4
    Last Post: 12-29-2008, 02:20 PM
  5. Replies: 2
    Last Post: 07-30-2007, 08:55 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •