RGJava
RGJava

Reputation: 37

How to compile JAVA on Sublime text 2 using Mac OS X?

I've looked all over the internet only finding very complicated results and now im not sure what to do.

Upvotes: 1

Views: 7282

Answers (1)

Nir Alfasi
Nir Alfasi

Reputation: 53535

Sublime text 2 has builtin Java support:

enter image description here

Which means that once you have opened the Java source, all you have to do is press command+B


What you described in the comments is a bit different - you should update your post with this information!

Devin posted a gist solution here:

You should add a new build-system by going to the menu:

Tools --> Build System --> New Build System

and add the following json and save it as "Java.sublime-build" into the default directory (which is something like: ~/Library/Application Support/Sublime Text 2/Packages/User/):

{
    "cmd": ["javac", "$file_name"],
    "cmd": ["java", "$file_base_name"],
    "working_dir": "${project_path:${folder}}",
    "selector": "source.java"
}

Next time you want to compile & run use "Java.sublime-build" from your build-systems.

Upvotes: 9

Related Questions