Search code examples
javasublimetext3build-system

javac not found sublime


Error: 'javac' is not recognized as an internal or external command, operable program or batch file

I'm trying to set up Sublime Text 3 to run Java.

I already set PATH, CLASSPATH and JAVA_HOME. This is what I have in MyJava.sublime-build:

{
    "cmd":["javac", "$file_name","&&","java","$file_base_name"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "path":"C:\\Program Files\\Java\\jdk1.8.0_102\\bin\\",
    "selector": "source.java",
    "shell":true
}

My PATH is C:\Program Files\Java\jdk1.8.0_102\bin.

ClassPath is JAVA_HOME/lib.

JAVA_HOME is C:\Program Files\Java\jdk1.8.0_102.

I read many similar questions but none of the suggestions work.


Solution

  • Solved! I had two copies of MyJava accidentally and was not using the right one. The code works :)