How to fix the compiler error in this program?

23,475

I had a similar problem, I do not know if it is specific to windows 7 or what.

I had installed several copies of the JDK thinking that would automatically fix it. It did not. Jgrasp somehow had multiple paths to the Java Compiler (javac), and the first one it went to was the JRE.

I solved it this way:

  1. I went to SETTINGS/ PATH/CLASSPATH / PATH(tab) / PATH(tab)
  2. click New
  3. (in a seperate windows explorer window I verified the correct path to the JDK) and added C:\Program Files\Java\jdk1.8.0_11\bin
  4. click Apply
  5. click Ok

That fixed it, and made the bad frustration go away.

Share:
23,475
MTNLegit
Author by

MTNLegit

Updated on October 23, 2021

Comments

  • MTNLegit
    MTNLegit over 2 years

    So i'm a student in high school new to the Java language and i'm using this program called jgrasp, which we use to program java. I just got the program for home to try to finish off a lab I was working on and when I compile, this shows up:

     ----jGRASP exec: javac -g EqualToThree.java
    
     ----jGRASP wedge2 error: command "javac" not found.
     ----   This command must be in the current working directory or
     ----   on the current system PATH or jGRASP PATH to use this function.
     ----   System + jGRASP PATH is "C:\Program       Files\Java;C:\WINDOWS\system32;C:\WINDOWS\system32\wbem;C:\Program Files\QuickTime\QTSystem;C:\Documents and Settings\Andrew\My Documents\Downloads;C:\WINDOWS\system32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\".
    
     ----   Use   Settings > PATH/CLASSPATH > Workspace   (PATHS tab)
     ----   to add directories to the jGRASP PATH.
    
     ----jGRASP: operation complete.
    

    I just recently upgraded my java to the latest version, and I honestly have no idea how to fix this. I did go to the class path, and selected the selected files it wants, but still no luck. Any idea?

  • shieldgenerator7
    shieldgenerator7 over 8 years
    I had the same exact problem and this fixed it. Thanks