英文:
Why does an exe file made with java immediately turn off?
问题
我在eclipse中制作了一个jar文件,并将其从jsmooth转换为exe文件。
exe文件已创建,但如果我双击它,它会立即关闭。
是我的代码有问题吗?
public class plz {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello World!");
for (int i = 0; i < args.length; i++) {
System.out.format("args[%d]: %2 %n", i, args[i]);
}
}
}
英文:
I made a jar in eclipse and converted it from jsmooth to exe.
The exe is created, but if I double-click it, it turns off immediately.
Is my code the problem?
public class plz {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello World!");
for(int i = 0; i< args.length; i++) {
System.out.format("args[%d}: %2 %n", i, args[i]);
}
}
}
答案1
得分: 1
是的,就是这样。您的代码指定应该循环遍历参数列表(在启动应用程序时提供)。一旦完成此操作,应用程序将停止。
英文:
Yes, it is.
Your code states that it should loop through the list of arguments(which you provide when you start the application). Once this is done, the application will stop.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论