[英]Sublime Text 2 - Error but not in IDE
我正在嘗試使用Sublime文本,並且更改了編譯設置以也顯示Java程序的輸出。 但是,我無法在Sublime Text 2中運行它,而IntelliJ可以很好地運行它,DrJava和Eclipse也可以。
我的錯誤是:
-----------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
響應較晚,但萬一有人想知道,在這種情況下,sublime尚未導入您請求的實用程序。 這是代碼運行而不是內容運行的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.