Eclipse Export executable Java Engineering/executable jar files (including Third-party jar packs) _java

Source: Internet
Author: User

Eclipse Export executable Java Engineering/executable jar files (including Third-party jar packs)

Brother deployed a new virtual machine, the new semester big get up! Because the reptile code was unstable, it was always run directly with Eclipse, and then the problem was modified. But this is a bit of a hassle, and eclipse itself takes up memory. So this afternoon to the previous code good stopgap, a lot of System.out.println replaced the log4j, the path AH database connection with the configuration file processing, and finally made into an executable jar, so that in the new virtual machine can be a big hit ^_^ Y

biu~ nonsense finish, get to the point, the Java project packaged into an executable jar have various methods, online many also not examples, what configuration Manifet file Ah and so on. one of the easiest ways to do this is to export runnable JAR file directly with Eclipse.

My eclipse version is indigo Service Release 1 (looks like the legendary 3.7, not sure)

1. First, right-click your Java project, select Export, and select Runnable JAR file under the Java folder, as shown in the following figure:

2. After selecting runnable JAR file, it will pop up the following dialog box, choose the export path, the default finish is actually OK. But it's two points to note:

The JVM parameters that you set up in run configuration are no longer functional after the package is finished, and need to be specified on the command line when the jar is executed (see 4);

For the third party package since there are three ways to deal with, in fact, no matter which one will not affect your use, I use the default is the first, he will be the third party jar package unpacked into SRC.


3. After finish, the executable jar package is generated, if your project contains configuration files, such as conf/ Xx.properties, then create the Conf directory in the same level as the jar package and put the xx.properties in the Conf directory, as shown in the following figure:

4. The final thing is to run the packaged jar file, execute the start Java command at the command line, and specify JVM parameters, such as setting initial allocated memory 128M, Max 256M:

Start Java-xmx256m-xms128m-jar Spider.jar

In the image above, we can see that there is a run.bat file in which there is only one line of command: Start Java-xmx256m-xms128m-jar Spider.jar, so you can double-click to execute the jar. When you need to change the startup parameters, just edit the Run.bat OK.

Well, it's a mark's process, but it's very simple, but it's a bit of a waste of time to go out and try out the information when you don't know. :)

Thank you for reading, I hope to help you, thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.