Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Setting Java Class Variable in Windows

Options
  • 12-02-2007 2:21pm
    #1
    Registered Users Posts: 2,279 ✭✭✭


    Hi there,

    I've been trying in vain to set up java on my dell inspiron 9400 laptop(XP) so that I can compile and run through Dos.

    I've gone into environment variables and set CLASSPATH = "C:\PROGRAM FILES\JAVA\......" in the appropriate folder, but when I go to compile it gives a batch error or something. I can get the exact error if ye want, but it'll be tomorrow before I can get back online with it.

    I have the JDK 1.5 or whatever installed so it should be working properly.

    Can anyone shed some light on this for me?

    Thanks in advance for any help. :)


Comments

  • Registered Users Posts: 500 ✭✭✭warrenaldo


    i am not entirely sure - but you made need to reset the computer before class wide variables are found. try it.
    if still problem search for the error on google. people have always had the problem before you.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    paste the actual error. 1.5 should set everything for you but if it doesn't (from memory)

    set PATH=<path to java bin>%path%;.
    set CLASSPATH=<java root directory>\jre\lib\rt.jar;.


    To compile + run you would...

    javac MyProgram.java
    java MyProgram.java


  • Registered Users Posts: 2,279 ✭✭✭PaulKK


    Thanks for the quick replies lads, id say i forgot to set the path = value. Ill try it when I go home.

    Cheers

    Paul


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    You do not need to reset computer to get variables to work. They will be set by the system when you open the dos box.

    Java5 should set it up in the environment variables, which I recall is..
    Right click My computer
    Select properties
    Select Advanced
    Click Environment Variables button.

    Once you set it there it will always be set when you open the command prompt.


  • Registered Users Posts: 1,127 ✭✭✭smcelhinney


    Hobbes wrote:
    You do not need to reset computer to get variables to work. They will be set by the system when you open the dos box.

    Java5 should set it up in the environment variables, which I recall is..
    Right click My computer
    Select properties
    Select Advanced
    Click Environment Variables button.

    Once you set it there it will always be set when you open the command prompt.

    Shortcut for My Computers > Properties is Windows+Pause/Break.

    Be careful setting global env variables, these overwrite user level ones. Not so important in single-user environment, but can wreak havoc if you are using a shared terminal. Someone else might have JAVA_HOME set to another location ..

    HTH,
    Stephen


  • Advertisement
Advertisement