如何从Eclipse插件项目生成可执行文件.jar? [英] How to generate an executable .jar from an Eclipse plug-in project?

查看:150
本文介绍了如何从Eclipse插件项目生成可执行文件.jar?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个能正常运行并可以部署到windows exe的eclipse插件项目。然而,我需要能够在其他平台上运行此应用程序,因此我想生成应用程序的可执行文件.jar文件。问题是我已经搜索到所有地方,所有这样做的方法需要一个主类,其中包含要提供的主要方法。因为我的项目是一个插件项目,它使用eclipse生成的Application类来启动应用程序,因此不包含可以引用的Main类。如果我忽略引用它,它将生成一个jar,但是它不会运行,因为它获得无法加载Main-class manifest属性错误。有没有办法绕过引用一个主类创建一个可执行的jar?

I have created an eclipse plug-in project that runs correctly and that can be deployed to a windows exe. However I need to be able to run this application on other platforms, so I would like to generate an executable .jar file of the application. The problem is that I have searched everywhere and all the methods of doing this require a "Main" class that contains a main method to be provided. Because my project is a plug-in project it makes use of an "Application" class that is generated by eclipse to kick start the application, and therefore does not contain a "Main" class that can be referenced. If i neglect to reference it a jar gets generated, but it won't run because it gets the "Failed to load Main-class manifest attribute" error.Is there a way to get around referencing a main class to create an executable jar?

推荐答案

这个想法没有帮助,因为eclipse.exe不是您分发中唯一依赖于操作系统的文件:SWT库不能在其他平台上使用。

The idea doesn't help, because the "eclipse.exe" is not the only OS-dependent file in your distribution: the SWT libraries can't be used on other platforms too.

使用eclipse,您必须为eclipse内的不同平台构建应用程序 em>。

With eclipse you'll have to build your application for different platforms from within eclipse.

这篇关于如何从Eclipse插件项目生成可执行文件.jar?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆