Created
January 18, 2012 16:18
-
-
Save DevinClark/1633819 to your computer and use it in GitHub Desktop.
This is a build script for Sublime Text 2 that will compile and run the open java file by simply pressing cmd + B. I am very new at Java so feel free to point out problems with this script. You can just drop this file in the User Packges folder and restar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cmd": ["javac", "$file_name"], | |
"cmd": ["java", "$file_base_name"], | |
"working_dir": "${project_path:${folder}}", | |
"selector": "source.java" | |
} |
Updated, use this one:
#!/bin/bash
# compiles all java files within directory and runs the one being edited in new terminal window.
for file in *.java
do
echo "Compiling $file"
done
javac *.java
RETVAL=$?
[ $RETVAL -ne 0 ] && exit
[ $RETVAL -eq 0 ] && (
echo "Compile Success! :)";
echo "Running $1.class";
#Create temporary file (in current directory) to execute compiled java class.
#Deletes itself after execution.
echo -e "cd \`dirname \$0\`\nclear\njava $1\necho ________________________________________________________________________________\nread -p \042Program Executed. [Press ENTER] to continue.\042\nrm -f sayhi.command" > sayhi.command;
chmod +x sayhi.command; open sayhi.command;
)
works well on my windows 8.1:)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use this bash script if you want it to automatically run in os x terminal