0

Sublime テキストを使用しようとしていますが、Java プログラムからの出力も表示するようにコンパイル設定を変更しました。ただし、Sublime Text 2 では実行できませんが、DrJava や Eclipse と同様に、IntelliJ では問題なく表示されます。

私のエラーは次のとおりです。

-----------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]

これを担当するコードのブロックは、次のとおりだと思います。

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);

私の JavaC.sublime-build ファイルは次のようになります。

{
    "cmd": ["runJava.bat", "$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java"
}

私の runJava.bat ファイルは次のようになります。

@ECHO OFF
cd %~dp1
ECHO Compiling %~nx1.......
IF EXIST %~n1.class (
DEL %~n1.class
)
javac %~nx1
IF EXIST %~n1.class (
ECHO -----------OUTPUT-----------
java %~n1
)

「C:\Program Files (x86)\Java\jdk1.7.0_05\bin」フォルダーにあります。

どんな助けでも大歓迎です!プログラム全体はここで見ることができます: http://pastebin.com/d5QDqMbJ

4

1 に答える 1