简体   繁体   English

尝试使用Eclipse导出到jar时出错

[英]Error when trying to export to a jar using Eclipse

I have a java file which runs normal in Eclipse but utilizes the apache commons FTP packages for some utilities. 我有一个Java文件,该文件在Eclipse中可以正常运行,但对某些实用程序使用了apache commons FTP软件包。 The issue I am running into is that after several days, it seems to just stop running with no errors. 我遇到的问题是几天后似乎没有任何错误地停止运行。 I believe this may be due to the Eclipse environment it is running in, so following advice of someone else, I tried to export this as a jar, and upon doing so I receive the following error: 我认为这可能是由于它在Eclipse环境中运行所致,因此在听取其他人的建议后,我尝试将其导出为jar,这样做时我收到以下错误:

Error screenshot: http://i.imgur.com/bHO6wtm.png 错误屏幕截图: http//i.imgur.com/bHO6wtm.png

My end-goal is that I would like this java program which runs fine in Eclipse to be an executable standalone that I can simply leave running somehow. 我的最终目标是,我希望这个可以在Eclipse中正常运行的java程序成为独立的可执行文件,我可以以某种方式保持运行状态。

  1. The screenshot shows your are compiling a library. 屏幕截图显示您正在编译库。 I suggest you to use a binary, pre compiled one. 我建议您使用预编译的二进制文件。
  2. To run a Java program you have to launch java -cp xxx.jar;yyy.jar... 要运行Java程序,您必须启动java -cp xxx.jar; yyy.jar ...

To make the thing simple, you have to compile and package your code into a jar, without its dependencies. 为了使事情变得简单,您必须将代码编译并打包到一个jar中,而无需依赖它。 This may be done with the Eclipse wizard Export as Jar or with a ANT script . 这可以通过Eclipse向导“ 导出为Jar”或使用ANT脚本来完成

To manage complex dependencies Maven may be used. 为了管理复杂的依赖关系,可以使用Maven

A lot of tutorial exists about Eclipse and how to export a Jar, 5 images follow, to show each step of this process: 存在很多有关Eclipse以及如何导出Jar的教程,下面是5张图像,以显示此过程的每个步骤:

启动向导

选择要添加的课程

检查警告并命名

让eclipse产生清单

可能会显示一些警告

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM