I used the following setup to run java in sublime 2, and I just tested the import function and it worked perfectly:
Make the bat file with the following and save it anywhere in your PATH. I suggest C: \ Program Files \ Java \ jdk * \ bin \ save everything together.
@ECHO OFF cd %~dp1 javac %~nx1 java %~n1
then edit C: \ Users \ your_user_name \ AppData \ Roaming \ Sublime Text 2 \ Packages \ Java \ JavaC.sublime-build, the content will be
{ "cmd": ["javac", "$file"], "file_regex": "^(...*?):([0-9]*):?([0-9]*)", "selector": "source.java" }
replace "javac" with the name of your bat file (for example, javacexec.bat) and save it.
Now you can run it with ctrl + b.
source share