Java learning path: Java project packaging and Publishing

Source: Internet
Author: User

Java project package and release

If you only want to publish it as an executable jar package, you can use the Export function of eclipse.

Use the Export function of eclipse to package all packages in the project into a pet. jar file. Assume that all the configuration files in the project are in the config folder of the Project root directory.

Create a folder named bushu and put the config folder in the project.
Use winrar to open all jar files referenced by the project and add all the package folders in the file to the pet. jar file.
Create the pet. dat file. Content: start java-Xmx512m-jar pet. jar
Run pet. dat

If you finally want to publish an executable program, I will use the address of the software project provided by the open-source project jsmooth.

Use the Export function of eclipse to package all packages in the project into a pet. jar file. All the configuration files in my project are in the config folder of the Project root directory.

Create a new folder named bushu and put the config folder, referenced external jar package, and pet. jar file in the project. All the package files are placed in the lib directory under bushu.

Open jsmooth, create a new project, and compile it to generate the exe file. In the attachment, all the images configured for jsmooth are captured.
First, package the compiled program into a jar file and then execute the exe file so that the code is invisible. However, the exe file cannot run on a computer without jre installed. If you want to install jre again
Setting environment variables is indecent. We need to package jre.

There are many plug-ins and methods introduced on the internet for these operations, but some of them are easy to use and some still need to be registered. After comparison, I got a lot of help on the blog "one mile Ice. Sort it out. With these tools, you can also smoothly release your java program!


1. package it into a jar file that can be executed by double-clicking.

Recommended plug-in: fatJar (used by Eclipse)


Http://sourceforge.net/project/showfiles.php? Group_id = 115990 & package_id = 125924


I am using Eclipse. Its own packaging method is not very nice when packaging images and other resources. You can use this plug-in.

Decompress the installation method and copy the net. sf. fjep. fatjar_0.0.24 folder under the plugins folder to the plugins under the eclipse installation directory.

This tool can be used to easily package eclipse projects into jar files. If you want to compress an executable jar file, select the main class.

Your project => Export... => the wizard contains fat jar =>...

2. Convert the jar file into an exe file. How to Use exe4j

Recommended tool: exe4j

Use exe4j to package java into exe

Http://www.blogjava.net/hadeslee/archive/2007/10/12/152228.html

When we write a program, sometimes there is a need, that is, we want our program to be an executable file, not
Jar files, in fact, most of the time, executable jar files can meet the requirements, but if our program needs to be protected, it is not safe to package it into a jar file, because the jar file is a decompressed file, you can see everything after decompression. Of course, you can also choose to confuse it, but after obfuscation, troubleshooting is not that easy, because when obfuscation, obfuscated the information of some classes. How can we ensure code security and easily eliminate errors? Therefore, packaging as exe is a good method. In fact, I do not want you to package it into an exe file today, because the exe file is not cross-platform after all, with the exe format, the original intention of java is lost.


Exe4j can be packaged into exe in various formats. You can package the jar into exe or reference an external
Jar files can also be packaged into a windows Service Program, and the minimum jre version can be set, and the startup screen can be set, although java6.0 has implemented this, however, the startup screen generated by exe4j is still not fast.


3. Package the exe file and the jre file into an installation file, which can be run on a computer without the Java virtual machine installed.

Recommended tool: install4j

Install4j Introduction

Http://www.blogjava.net/hadeslee/archive/2007/10/15/152855.html

Install4j is a powerful multi-platform Java installation file generation tool used to generate Java application localization installation and application release. Install4j
It is easy to use, tightly integrated to the target platform, and flexible JRE management and deployment options.

Create a publishing tree

The graphical user interface of install4j allows you:

* Completely custom publishing tree

In each directory of the publishing tree, you can set the entire directory content or a single file in any directory on the disk. The defined view and result view allow you to have full control over the files that will be released by the installer.

* Handling differences between specific platforms

Install4j provides a convenient "include/exclude" mechanism to adapt to the platform for publishing.

* File permissions defined for Unix, Linux, and Mac OS X

For each element of the publishing tree, you can customize user access permissions when it is installed on a platform similar to Unix.

* Define an excellent uninstall Policy

For each element of the release tree, you can decide whether to delete it during uninstallation.

* Define an overwrite Policy

You can configure different overwrite policies for each element of the release tree. When you need to overwrite files during installation, these overwrite policies will instruct nstall4j to perform corresponding operations.

* Define Installed Components

You can define file and directory groups to form separate installation components, so that you can provide users with the option to install only certain components.

In fact, if a good application is not well deployed, others can only look at it and sigh. Now there is
Install4j, many deployment problems are almost all solved. we can use exe4j to package a java application and then use install4j to publish a java application. Previously, the difficulty in deploying java programs has almost been solved. install4j is not only suitable for packaging, but also provides a set of powerful and practical platform-related APIs. these are also very helpful for extending our programs.


Install4j Enterprise Edition serial number
I searched for this thing for a long time and got it. I installed 3.2. The serial numbers below are the same and can be used. Share it, saving you the trouble to find it again.


Install4j Enterprise Edition 3.1.3 registration code, serial number, cracked version, registration Machine

S/N: A-G42M # 03948F-pzwgavu2ohmw #316
S/N: A-G42M # 03948F-pzwgavu2ohmw #508

Install4j proffe0000edition 3.1.2 registration code, serial number, cracked version, registration Machine

S/N: A-G4iN # 89756F-9qotdnr5rq9a #0015

Copy; 2010 Baidu

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.