I’m trying to use Sublime text and I have changed my compiling settings to also display the output form the java program. However, I can not run it in Sublime Text 2, while IntelliJ displays it fine, as does DrJava and Eclipse.
My error is:
[code]> -----------OUTPUT-----------
This program will calculate the average for the given number of student's marks How many students are in the class? Exception in thread "main" java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at Unit4ClassAverage.main(Unit4ClassAverage.java:33) [Finished in 0.8s with exit code 1][/code]
The block of code responsible for this, I’m guessing is:
System.out.println("This program will calculate the average for the given number of student's marks");
System.out.println("How many students are in the class?");
strInput = br.readLine();
intStudents = Integer.parseInt(strInput);
My JavaC.sublime-build file looks as follows:
{
"cmd": "runJava.bat", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java"
}
and my runJava.bat file looks as follows:
@ECHO OFF
cd %~dp1
ECHO Compiling %~nx1.......
IF EXIST %~n1.class (
DEL %~n1.class
)
javac %~nx1
IF EXIST %~n1.class (
ECHO -----------OUTPUT-----------
java %~n1
)
which is located in my “C:\Program Files (x86)\Java\jdk1.7.0_05\bin” folder.
Any help would be appreciated!
The full code can be seen http://pastebin.com/d5QDqMbJ