Skip to content

Instantly share code, notes, and snippets.

@burturt
Last active July 23, 2020 20:26
Show Gist options
  • Save burturt/d4e813a8e3c61bb51af4b3a41ada8b87 to your computer and use it in GitHub Desktop.
Save burturt/d4e813a8e3c61bb51af4b3a41ada8b87 to your computer and use it in GitHub Desktop.
Sublime text 3 build command to use terminal to compile and run java since the built-in console does not have user input. MacOSX only.
{
"shell_cmd": "osascript -e 'tell app \"Terminal\" to do script \"cd $file_path && javac *.java && java $file_base_name\" in front window activate'"
}
@burturt
Copy link
Author

burturt commented Jul 23, 2020

Couple notes:

  • This script will work if terminal is not open or if you have a terminal window open, it'll use that. If terminal is open but no windows are open, it will error out
  • Tested on 10.14.6, IDK if it works on any other versions though I don't see why not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment