#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    231
    Rep Power
    16

    Need help please!


    Hi,

    I got an error when I was trying to complile a source code.

    'javac' is not recognized as an internal or external command, operable program or batch file.

    What did I do wrong? How do I fix the error?

    Thanks.
  2. #2
  3. No Profile Picture
    Hang your freedom higher.
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2005
    Posts
    659
    Rep Power
    161
    Have you added the full path to your java bin directory to your PATH environment variable?
    "Badges? We ain't got no badges. We don't need no badges! I don't have to show you any stinkin' badges!!"
  4. #3
  5. Daniel Schildsky
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Mar 2004
    Location
    KL, Malaysia.
    Posts
    1,557
    Rep Power
    1624

    more help


    In addition to atlantisstorm's advice, here are some more advices:

    1. Please make sure that J2SE is installed in your PC.

    2. Test and confirm that J2SE is installed correctly in your PC by executing
    Code:
    java -version
    in command prompt/shell (for unix).

    3. If atlantisstorm's suggestion is not working, try compile the source codes from the bin folder of your J2SE home path. You have to specify the class path by using -classpath switch when you issue javac command.

    Hope this helps.
    When the programming world turns decent, the real world will turn upside down.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2008
    Posts
    7
    Rep Power
    0
    Go to My Computer -> right click -> Properties -> Advanced -> Enviroment Variables

    Add the path to ur "javaSeFolder\bin" folder to the path variables (just copy and paste the link after the ";")

    restart the cmd and type javac again
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    231
    Rep Power
    16
    Thanks for your replies. After configuring the environment variable, I got the compiler to work. However, when I run the .class file, I got an Exception error. Please see below.

    Code:
    public class Variable
    {
       // Print the number of keys on a piano
       
       public static void main (String[] args)
       {
          int keys = 88;
          System.out.println ("A piano has " + keys + " keys.");
       }
    }
    java Variable.class

    Exception in thread "main" java.lang.NoClassDefFoundError: Variable/class
    Caused by: java.lang.ClassNotFoundException: Variable.class
    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)
  10. #6
  11. Feelin' Groovy
    Devshed Supreme Being (6500+ posts)

    Join Date
    Aug 2001
    Location
    WDSMIA
    Posts
    10,135
    Rep Power
    5056
    Leave off the ".class" when you run your app.

    Code:
    $prompt> java Variable
    ~
    Yawmark
    class Sig{public static void main(String...args){\u0066or(int
    \u0020$:"v\"ʲ\"vΤ\"".to\u0043h\u0061rArray()
    )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
    +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}}
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Posts
    231
    Rep Power
    16
    Thanks all.

    Comments on this post

    • Yawmark agrees : You're welcome

IMN logo majestic logo threadwatch logo seochat tools logo