When you run Eclipse's project on the command line, you need to generate a jar package that can be executed, which can be executed at the command line, and in two cases, a jar package that does not call a third party in the project, which is relatively simple and has a lot of resources on the web. This article focuses on the second case the project called a third-party jar package, and there are two ways to generate the package:
method One: manually generate a "MANIFEST". MF " file and also need to write some information about what's going on: too complex, and extremely error-prone, if interested please refer to the blog: http://www.cnblogs.com/lanxuezaipiao/p/3291641. HTML
method Two: simple and error-prone, is to install the Fat Jar plug-in under Eclipse, the specific installation method:
1. Eclipse Online Update method (note the Eclipse version number,Eclipse4.4 Error, need to install manually)
Help > Install New software > Add,
Name:fat Jar
Location:http://kurucz-grafika.de/fatjar
2. The Eclipse Plugin manual installation method
: http://downloads.sourceforge.net/fjep/net.sf.fjep.fatjar_0.0.27.zip?modtime=1195824818&big_mirror=0
Copy the files from the extracted plugins to the plugins directory in the Eclipse installation directory, and then restart Eclipse.
Note: The downloaded plugin is basically: the net.sf.fjep.fatjar_0.0.31 version, which supports all versions prior to eclipse4.4. :net.sf.fjep.fatjar_0.0.31 versionHowever, the eclipse4.4 version requires: net.sf.fjep.fatjar_0.0.32 version,:net.sf.fjep.fatjar_0.0.32 version
How to use the download after successful installation:Step 1: Right-click Project selection buile Fat Jar:
eclipse4.4 The above version may appear (right click on the project to select Export, click Select Other)
Step 2: Configure the jar file storage directory, main main file, etc., such as:
Step 3: Select the third-party jar package you want to use
Finally in the command line input: Java-jar Killcheatfans_fat.jar (note to run in the directory of the Jar package)
Be sure to note the version number of Eclipse
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Java methods to run the Eclipse project on the command line