.jar 可在命令行中工作,但不能在 Windows 资源管理器中工作

发布于 2024-09-29 14:27:11 字数 598 浏览 1 评论 0原文

我有一个 SWT 应用程序,我正在尝试为其创建可运行的 .jar;不幸的是,我似乎无法从 Windows 资源管理器运行它,因为我从 Java 虚拟机启动器收到一条错误消息:

“找不到主类 gui.MainWindow。程序将退出。”

但是,它将通过命令行运行

java -jar xxxxx.jar

我花了相当多的时间查看导致我以下问题的线程:

  1. 编辑清单文件切换,
  2. 通过 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:

  1. edit the manifest file
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紅太極 2024-10-06 14:27:11

如果你的应用程序。有一个 GUI,请使用 Java Web Start 启动它。

If your app. has a GUI, launch it using Java Web Start.

梨涡少年 2024-10-06 14:27:11

我刚刚为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文