Sublime Forum

How to set up sublime text 3 with java on Mac?


I’m having a hard time setting up sublime text 3 with java on Mac. I tried to open the terminal and enter /usr/libexec/java_home. It show me this:/Library/Java/JavaVirtualMachines/jdk-13.jdk/Contents/Home. this is what I believe to be the pathway to my java.then I copy it into sublime text 3. and save it as java.subime-build. then I try to run “hello world” command and it says no build system.

to simplify it this is what it looks like before I save it on sublime editor:
“cmd”: [“javac”, “$file_name”,"&&",“java”, “$file_base_name”],
“file_regex”: “^[ ]File “(…?)”,line([0-9]*)”,
“path”: //Library//Java//JavaVirtualMachines//jdk-13.jdk/Contents/Home",
“selector”: “”,
“shell”: true

now save as java.sublime-build but the code doesn’t run at all. it just says no build system. How do I resolve this issue?



When you see No Build System as an error, it’s an indication that the structure of the sublime-build file is not valid JSON.

In the sample you pasted in your question, all of the quotes are “fancy” quotes (i.e. they curl and are typographic quotes as opposed to regular double quotes). That might be due to the fact that you didn’t wrap the text in a code block, but it’s always a good idea to check.

The value of the path key is also missing it’s leading double-quote character, which could also be an issue.

When in doubt, pasting the code for your sublime-build into something like JSON Lint can be handy to see where any problems might be.

Note that the JSON parser in Sublime is lenient enough to allow comments and trailing commas in places where standard JSON would balk, so in those cases you can ignore those sorts of problems if a JSON linter produces them.