我用 Java netbeans 做了一个桌面应用程序,它是一个带有一些组件的 Jframe。我构建了它并在项目文件夹的 dist 文件夹中创建了 .jar 文件。我已经在我的电脑上安装了 jre(Java 运行时环境)。当我尝试使用 jre 打开 .jar 时,我什么也没有,什么都没有出现。我能做些什么 ?
1 回答
https://netbeans.org/kb/articles/javase-deploy.html#Exercise_1
The link above will take you to a tutorial. Jar files are not executable by default. You need to specify a starting class to make a jar file executable.
If this doesn't work, then make sure you have called setVisible(true)
on your JFrame.
Edited to add: (author added info)
When I try to run through CMD there's Unsupported major.minor version 52.0
This means your JRE version does not match your compiler version. You can confirm with the -version option, then fix your path to use Java from the same place your compiler lives.