Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default [SOLVED] Can't change JDK directory.

    Hello All,

    I just started a Java class... and very glad I found this forum.


    I installed JDK and everything that needed to be installed...
    I also tried to run jGRASP, but have been having difficulties getting it running.

    When I load a program in jGrasp, and try to compile it, this is what I get.

    ----jGRASP exec: javac -g F:\SOURCECODE\Chapter 01\Payroll.java

    ----jGRASP wedge2 error: command "javac" not found.
    ---- This command must be in the current working directory
    ---- or on the current PATH to use this function.
    ---- PATH is ";C:\Windows\system32;C:\Windows\system32;C:\Windo ws;C:\Windows\System32\Wbem;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\".
    ----
    ---- Make sure you have the full JDK (J2SE SDK or other), not just the JRE, installed.
    ---- The J2SE SDK is available from java.sun.com.
    ----jGRASP: operation complete.



    What frustrates me, is I cannot figure out where in the jGrasp program that i need to configure to the JDK directory.

    JDK is installed in:
    C:\Program Files\Java\jdk1.6.0_10

    .........
    after getting frustrated with this, i installed NetBeans.
    And me being brand new to programming, there was too many things going on. jGrasp seemed simpler when we used it in class.


    Thank you very much in advance for your help.

  2. #2
    Eku
    Eku is offline Senior Member
    Join Date
    May 2008
    Location
    Makati, Philippines
    Posts
    234
    Rep Power
    6

    Default

    in ur environment variables.

    Control Panel --> System
    In Advanced Tab click the Environment Variables Button

    set the following
    click new in the user variables

    Java Code:
    name: java_home
    value: C:\Program Files\Java
    then click new again

    Java Code:
    name: PATH
    value: %PATH%; C:\Program Files\Java\jdk1.6.0_10\bin
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

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

    Default

    Then type javac on the command prompt and see what's the output is. There you get the all javac compiler possible options, if you set the class path correctly.

  4. #4
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    I did exactly as told, and I still get the same error in jGrasp.

    So I tried with NetBeans.
    This is the error I get.


    init:
    deps-jar:
    Compiling 1 source file to C:\Users\duran\Desktop\payroll\build\classes
    C:\Users\duran\Desktop\payroll\src\payroll\Main.ja va:1: class Payroll is public, should be declared in a file named Payroll.java
    public class Payroll
    1 error
    BUILD FAILED (total time: 0 seconds)


    ----
    netbeans, not too excited about using that.
    I just want to get jGrasp going to input simple programs to understand java better, but am having so much difficulty.

    Eranga... I typed in javac in CMD propt, and nothing happened. Says it is not recognized as an internal or external command...

    Im sorry if my questions are really beginner and frustrating, but I really have to get started on this. So I need help.

    Thanks in advance.

  5. #5
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by Eku View Post
    in ur environment variables.

    Control Panel --> System
    In Advanced Tab click the Environment Variables Button

    set the following
    click new in the user variables

    Java Code:
    name: java_home
    value: C:\Program Files\Java
    then click new again

    Java Code:
    name: PATH
    value: %PATH%; C:\Program Files\Java\jdk1.6.0_10\bin


    Should I remove what was ALREADY in there and have just the two you told me to put in? There are two additionals there:

    there is TMP and TEMP.
    %USERPROFILE%\AppData\Local\Temp
    (should I remove those?)

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

    Default

    Quote Originally Posted by JavaNewbie0000 View Post
    there is TMP and TEMP.
    %USERPROFILE%\AppData\Local\Temp
    (should I remove those?)
    No, don't remove them anyway. Just add the new class path 'C:\Program Files\Java\jdk1.6.0_10\bin' in the PATH field. If there something is already available, add a semicolon(;) mark at the end and after that put your class path mentioned above.

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

    Default

    Quote Originally Posted by JavaNewbie0000 View Post
    I did exactly as told, and I still get the same error in jGrasp.

    So I tried with NetBeans.
    This is the error I get.


    init:
    deps-jar:
    Compiling 1 source file to C:\Users\duran\Desktop\payroll\build\classes
    C:\Users\duran\Desktop\payroll\src\payroll\Main.ja va:1: class Payroll is public, should be declared in a file named Payroll.java
    public class Payroll
    1 error
    BUILD FAILED (total time: 0 seconds)
    This is because you class name and the file name is not same. Your file name is Main, but the class name is Payroll. So change one of them and set both of them to same.



    Quote Originally Posted by JavaNewbie0000 View Post
    Eranga... I typed in javac in CMD propt, and nothing happened. Says it is not recognized as an internal or external command....
    That means, the settings on the class path is still not correct. Since environment variables are wrong, your system can't find the javac as a valid program.

  8. #8
    Join Date
    Jul 2008
    Posts
    7
    Rep Power
    0

    Default

    Finally got the compiler to work. I had to change information in SYSTEM VARIABLES.

    ----
    I also had to take %path% out from

    "name: PATH
    value: %PATH%; C:\Program Files\Java\jdk1.6.0_10\bin"

    It wouldn't work with %path%; being in there.



    I really appreciate all the help. Extremely friendly and helpful community here.

    Thank you all,

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

Similar Threads

  1. How can I change a project's build directory?
    By sylvpan in forum NetBeans
    Replies: 11
    Last Post: 02-03-2011, 06:18 AM
  2. How to change JDK?
    By mew in forum Eclipse
    Replies: 5
    Last Post: 05-21-2010, 05:21 AM
  3. How ro change the locale of JVM
    By ravi.ks007@hotmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-26-2007, 06:17 AM
  4. Change my for loop
    By javaplus in forum New To Java
    Replies: 4
    Last Post: 12-12-2007, 11:00 AM
  5. Is it possible to change the '\n' into ' ' ...
    By johnny7white in forum New To Java
    Replies: 1
    Last Post: 11-15-2007, 02:32 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
  •