.jar 可在命令行中工作,但不能在 Windows 资源管理器中工作
我有一个 SWT 应用程序,我正在尝试为其创建可运行的 .jar;不幸的是,我似乎无法从 Windows 资源管理器运行它,因为我从 Java 虚拟机启动器收到一条错误消息:
“找不到主类 gui.MainWindow。程序将退出。”
但是,它将通过命令行运行
java -jar xxxxx.jar
我花了相当多的时间查看导致我以下问题的线程:
- 编辑清单文件切换,
- 通过 javaw.exe 的运行时版本
但均无济于事。
我正在 eclipse 中创建可执行的 .jar 文件(包括我引用的 swt 库),并且还尝试了 fat-jar 插件。 同样,它将在 Eclipse 中运行内部,不会出现任何问题。
我无法承担 .bat 等解决方法或将其转换为 .jex
我有一种挥之不去的感觉,这取决于我在 64 位系统上,但是,我已经经历过 64 位和 32 位系统如前所述,javaw.exe 的位版本。
任何建议都非常受欢迎。
I have an SWT application that I'm trying to create a runnable .jar for; unfortunately, I cannot seem to run it from Windows Explorer, as I get an error from the Java Virtual Machine Launcher stating it:
"Could not find the main class gui.MainWindow. Program will exit."
However, it will run through command line
java -jar xxxxx.jar
I have spent a considerable amount of time looking through threads that have lead me to:
- edit the manifest file
- switch through the runtime versions of javaw.exe
all to no avail.
I am creating the executable .jar file in eclipse (including my referenced swt libraries), and have also tried the fat-jar plugin.
Again, it will run inside of eclipse with no issues.
I cannot afford a work-around such as a .bat or turning it into a .jex
I have a nagging feeling it is down to me being on a 64-bit system, however, I have gone through both 64-bit and 32-bit versions of javaw.exe as previously stated.
Any suggestions would be more than welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你的应用程序。有一个 GUI,请使用 Java Web Start 启动它。
If your app. has a GUI, launch it using Java Web Start.
我刚刚为 64 位系统重新安装了 JDK 和 JRE,并使用 默认程序编辑器
重新分配.jar 与 64 位 jre6 javaw.exe 关联,这似乎解决了我的问题。
I have just re-installed the JDK and JRE for 64-bit systems and have used Default Programs Editor
to re-assign the .jar association to the 64-bit jre6 javaw.exe, which, seems to have solved my problem.