Results 1 to 3 of 3
  1. #1
    mathias is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default Help, starting with java

    Hi, It asks me to download java sdk.
    I download it, and i receive a folder in my c:/
    When i try to compile "javac" it says "javac is an invalid command"...
    I was wondering if someone could just teach me how to get past this bit maybe on messenger or here...
    I would even allow a remote assistance so you can do demonstrations...
    I really want to learn this language....
    Thanks.

  2. #2
    yiweiang is offline Member
    Join Date
    Aug 2007
    Posts
    15
    Rep Power
    0

    Default

    Hi there,

    Don't worry. Did you set the class path to your jdk bin? If not, right click on My Computer--System Properties--Advanced--Environment Variables. Look for the CLASSPATH variable. Then go and locate your java jdk's BIN directory, copy that directory in into your classpath variable. javac should now work.

    Alternatively, you can install an IDE that often does this for you. I personally use NetBeans. And i believe that it sets the path automatically? Correct me if i'm wrong, i havent done an installation of netbeans in a while.

  3. #3
    koskow is offline Member
    Join Date
    Aug 2007
    Posts
    1
    Rep Power
    0

    Smile javac manual pathing

    Here is what I did to make it work.

    First... here was my helloworld2.java code
    __________________________________________

    /**
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    */
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    }
    }

    ___________________________________________
    I had my helloworld2.java on my desktop.

    My javac app is located at: c:\program files\java\jdk1.6.0_02\bin

    Here is the code I used in the command line (typed cmd in my search bar under the start menu (vista) or from "Run" in XP to get command line running)

    cd.. until I was at the root of C:

    C:> "\Program Files\Java\jdk1.6.0_02\bin\javac" c:\Users\Kevin\Desktop\helloworld2.java

    What this line of code does is tells the computer to use the javac program, located in the \Program Files\Java\jdk1.6.0_02\bin\ directory to compile the next item, which is the java script located on my desktop. - helloworld2.java

    This should work on vista

    This isn't a bandaid. It is normal command line stuff. You can path it differently as stated in the last post, so the application always knows to use the javac program when called, no matter what directory tou are in.

    For instance, if you type "notepad" into the command line, in any directory, the application notepad.exe will launch.

    I hope this helps.
    Last edited by koskow; 08-15-2007 at 08:16 AM. Reason: pathing spelt wrong in title

Similar Threads

  1. Indexing starting with 1
    By ravian in forum New To Java
    Replies: 4
    Last Post: 01-04-2008, 01:03 PM
  2. just starting
    By specbailey in forum New To Java
    Replies: 23
    Last Post: 08-14-2007, 12:25 AM

Posting Permissions

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