Results 1 to 4 of 4
  1. #1
    fogus is offline Member
    Join Date
    Mar 2008
    Posts
    43
    Rep Power
    0

    Default CLASSPATH Environment Variabl

    Hello,

    Pretty used to coding in Java, but I can't compile anything after imaging from an install of 4 months ago. I didn't have Java JDK installed then, and after I installed it this time, nothing works. I screwed around with the Environment Variable and I get nothing.

    In SciTE:

    Java Code:
    >javac spellcheck.java
    >The system cannot find the file specified.
    >java spellcheck
    java.lang.NoClassDefFoundError: spellcheck
    Caused by: java.lang.ClassNotFoundException: spellcheck
    	at java.net.URLClassLoader$1.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: spellcheck.  Program will exit.
    Exception in thread "main" >Exit code: 1
    In the command prompt:

    Java Code:
    S:\asdf\asdf\asdf\asdf\asdf\src>javac sp
    ellcheck.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    Why is javac not a recognized internal or external command? Why can't my java stuff compile?

    I set my CLASSPATH variable to null and then to:

    Java Code:
    C:\Program Files\Java\jdk1.6.0_10\src.jar;C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\il8n.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\jaws.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_10\jre\demo\sound\JavaSound.jar;C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingSet2\SwingSet2.jar;C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingApplet\SwingApplet.jar;C:\Program Files\Java\jdk1.6.0_10\;C:\Program Files\Java\jdk1.6.0_04\Bin;C:\Program Files\Java\jdk1.6.0_10\Lib;
    Which is:

    Java Code:
    System Variables\CLASSPATH
    
    C:\Program Files\Java\jdk1.6.0_10\src.jar;
    C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;
    C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;
    C:\Program Files\Java\jdk1.6.0_10\jre\lib\il8n.jar;
    C:\Program Files\Java\jdk1.6.0_10\jre\lib\jaws.jar;
    C:\Program Files\Java\jdk1.6.0_10\jre\lib\rt.jar;
    C:\Program Files\Java\jdk1.6.0_10\jre\demo\sound\JavaSound.jar;
    C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingSet2\SwingSet2.jar;
    C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingApplet\SwingApplet.jar;
    C:\Program Files\Java\jdk1.6.0_10\;
    C:\Program Files\Java\jdk1.6.0_10\Bin;
    C:\Program Files\Java\jdk1.6.0_10\Lib;
    In expanded form, which I got from: h-t-t-p:-/-/-w-w-w-.wilsonmar.c-o-m/1envvars.h-t-m (remove dashes)

    Any ideas guys?

    Cheers,
    fogus

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    First of all try it on the command prompt. Using 'CD' change to the working folder where your Java class files are located. Then type the following on the prompt.

    path=C:\Program Files\Java\jdk1.6.0_10\bin\
    Once you type press enter key after type the above command nothing should happen. Then type 'javac' and see what happen. You must see some descriptions about Java.

  3. #3
    fogus is offline Member
    Join Date
    Mar 2008
    Posts
    43
    Rep Power
    0

    Default

    Yes, Eranga, that did work. How do I make it permanent?

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Ok do the following.

    1. Right-click on My Computer and choose properties
    2. Click on Advanced tab and click the button 'Environment Variables'
    3. On 'System Variable' list find the variable named 'PATH'
    4. Select it and click edit
    5. Add a semicolon at the end of the value field and add the path
    6. In your case path is something like C:\Program Files\Java\jdk1.6.0_10\bin\

Similar Threads

  1. help me to set classpath
    By srinivaspuvvala in forum Java Servlet
    Replies: 3
    Last Post: 01-18-2009, 08:13 PM
  2. Classpath on mac osx
    By jacobb in forum JDBC
    Replies: 0
    Last Post: 06-12-2008, 10:41 PM
  3. Set classPath?
    By rgbosque in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 03:14 PM
  4. GNU Classpath 0.96.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 11-01-2007, 05:14 PM
  5. GNU Classpath 0.96
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 10-16-2007, 07:35 PM

Posting Permissions

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