繁体   English   中英

Sublime Text 2-错误,但在IDE中不存在

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM