Options

JAVA command-line question (Environment Variables)

cussetacusseta Member Posts: 47 ■■□□□□□□□□
I am just beginning to learn Java (day one with NO programming experience icon_eek.gif ) everytime I want to compile something (javac), I have to be in the "c:\program files/java/jdk1.6.0/bin" directory in order to use that javac command. I know you can add that directory to the Environment Variables section under Advanced tab in System properties so that that the javac command will work in ANY directory. I just don't know exactly what to type in User Variable and System Variable once I click on "New". There is a spot for Variable and Value I believe and I can't seem to find the answer to this one online. If I'm leaving important info out, let me know. Wow, that was difficult!
Sometimes you've got to prove to your friends that you're still worth a damn!

Comments

  • Options
    sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    Add the entire path to your "Path" variable. As you will see there are already several path statements listed, just add a semicolon ; (no space) and then c:\program files\java\jdk1.6.0\bin to the end of the existing paths already listed.
    All things are possible, only believe.
  • Options
    TeKniquesTeKniques Member Posts: 1,262 ■■■■□□□□□□
    You can compile your code through the command line as you have been doing with javac and adding the environment variable. If you like a nice IDE to work with try this one:

    http://www.jcreator.com/

    You can compile and run your code within the IDE which IMO is a lot easier.
  • Options
    JDMurrayJDMurray Admin Posts: 13,031 Admin
    I don't consider myself to be a Java programmer, but I have successfully written a few small Java apps using the Eclipse Java IDE and I recommend giving it a try. Eclipse is Open Source and free to use.

    http://www.eclipse.org/
  • Options
    cussetacusseta Member Posts: 47 ■■□□□□□□□□
    Thanks sprkymrk, that did the trick!! Just out of curiousity, do I not need to add anything to the User Variable list? When I Googled the topic, it said something about adding that path to the User Variable list also.

    I'm definitely gonna check out those other methods of compiling. Can't wait to get started. Thanks guys!!
    Sometimes you've got to prove to your friends that you're still worth a damn!
  • Options
    sprkymrksprkymrk Member Posts: 4,884 ■■■□□□□□□□
    cusseta wrote:
    Thanks sprkymrk, that did the trick!! Just out of curiousity, do I not need to add anything to the User Variable list? When I Googled the topic, it said something about adding that path to the User Variable list also.

    Glad to help! :)
    Regarding your question - no, since you added it to the system variables it will be in effect for all users of that computer. If you wanted, you could have instead placed the path statement in the user variable area, and then it would have only affected your path statement.
    All things are possible, only believe.
Sign In or Register to comment.