java create exe installation package Package With JRE from the start

2010-05-05  来源:本站原创  分类:Java  人气:282 

[Size = medium] target: as the installed package has been installed next qq can be as simple as can be unloaded, claims process starts automatically, no separate installation of JRE,

Just writing this solution, I really hate every means Microsoft. Hey helpless ah. Fortunately, I eventually came out was to share, are you, long time

Bo has not written.

The first step jre lose weight, remove the jre \ lib \ rt.jar class is not used, remove charsets.jar does not use the character set encoding. MyWork open

Source project (http://mywork.sourceforge.net/) in a thin band over the JRE6.0, very small only a few M. If there is a need in

The basis of appropriate fertilization, for example, prompted a class can not find, as long as the complete package rt.jar jre find this under the category where the package added to the thin

Can pass through the jre.
The second step uses pack200 compression, compression is very alarming, refer to the official manual for the specific use, the following is the simplest compression and decompression

Command (if you want to create installation package, then compression is not recommended because the extract is not convenient, other written procedures need to unzip)
Compression command D: \ xxxxx \ pack200 rt.jar.pack.gz rt.jar
Extract command unpack200-r jre \ lib \ rt.jar.pack jre \ lib \ rt.jar
The third step would be own procedures labeled jar package, pay attention to specify the main class, together with the dependence of the jar package into the jre \ lib \ ext below (of course you can

Not very dry, by writing a batch specified CLASSPATH) directly into ext following benefits will be reflected in the following

The fourth step in the jre folder in the top directory the following batch% 1 start preparing the role of the following to say
@ SET PATH =. / jre / bin;% 1;% PATH%;
@ Start javaw com.Main (according to practical situation for their program entry)

The local jre or jdk folder, rename, and the next knock at the cmd java jre to confirm that the machine has failed, click on the batch, test if the program

Normal startup, then continue to look down, if the program does not start, the @ start javaw com.Main rewritten java com.Main restart

Debugging, the look is not a lack of class.

Step into exe program will batch compile, use Quick Batch File Compiler Tools

(Http://www.abyssmedia.com/download.shtml), program is very simple to use, not in the presented here, E article can be bad

Speaking of the new century to go to download the Chinese, pay attention to if you want to create an installation package must use ghost mode, can not use the console mode.

Step Six production installation package using the InnoSetup tool (Baidu look everywhere to download), this tool using the wizard, this part is not presented to the

After the guide will be prompted to generate the script, save the script and generate the exe installation package, run the installation package, if the generated files out of program structure and

Four-step is the same, and can run it, install the package produced. (This step is the selection process when the batch file with exe and add to the mix jre

Note that no pack2000 jre must be compressed, or need to write in the install script inside another decompression program)

Seventh step procedure with the windows start automatically, add the following code to modify the installation script
[Registry]
Root: HKLM; Subkey: "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run"; ValueType: string;

ValueName: "program name"; ValueData: "" "(app) \ main program. Exe" "" "(app) \ jre \ bin" ""

It uses the% 1 which are familiar to students of the batch system from the start know when. Is not representative of the folder where the program, so it

Pass the jre is located in the folder parameter, @ SET PATH =. / jre / bin;% 1;% PATH%; in to add to the path of jre.

Step off the eighth to see whether the procedures under the re-login automatically activated. (Can not install jre on the machine under test)

My installation package size is 10M or so, I rely on many third-party jar package, or can be smaller, and finally you can add a shell or use rar Ya

Under reduced

================================================== ================================
Java5 of a compression tool with: Pack200, this tool can efficiently common jar file compression. The implementation principle is based on Java

Class-specific structure, combined constant pool, get rid of useless information to achieve efficient compression of the java class. Because it is specialized on the Java class to compress

, So the compression of the common file compression software, and general no different, but for the Jar file was able to easily reach 10-40% of the compression

Rate. This is very useful Java application deployment, especially for mobile Java computing, can greatly reduce the code downloads.
Java5 also provided the technology API interface, you can be embedded into your applications to use. The approach is simple, the following short

Short a few lines of code that can achieve compression and decompression jar:
Compression
Packer packer = Pack200.newPacker ();
OutputStream output = new BufferedOutputStream (new FileOutputStream (outfile));
packer.pack (new JarFile (jarFile), output);
output.close ();
Extract
Unpacker unpacker = Pack200.newUnpacker ();
output = new JarOutputStream (new FileOutputStream (jarFile));
unpacker.unpack (pack200File, output);
output.close ();
More details, see the following URL:

http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/pack200.html
================================================== ================================
Now released a swing of the program, including the java web start and applet are two versions, but due to the introduction of third-party packages, hair

Cloth to almost 5MB, even in the local area network is also intolerable that the slow loading speed, after all, for most applications, the network

Bandwidth is the ultimate system bottlenecks.

Fortunately JDK5 the Java Web Start and Java Plug-in provides for gizp and pack200 compression support, through the compression will

Java web applications based on compression in the jar to get thin again leap.

gzip
jar package contains the contents of the non-Java class files more resources, such as JPEG, GIF, etc., would be more appropriate to use gzip

pack200
jar package is the class most of the information content, then pack200 is definitely your first choice program, because pack200 is specific to class

The java class to optimize the design, mainly in the following areas:

It merges and sorts the constant-pool data in the class files and co-locates them in the

archive.
It removes redundant class attributes.
It stores internal data structures.
It use delta and variable length encoding.
It chooses optimum coding types for secondary compression.

Signature of the entire publishing process compression

*** / JDK5/bin/pack200 - repack demo.jar
- Repack the role of equivalence and pack200 and unpack200 two directives, their role is demo.jar inside the class structures Pack200

Finishing the format, because the jar package signatures need to hash calculation of the class structure, so if you do not carry out a jar of Pack200 format

Finishing it, so after signing with pack200 compression will result in an invalid signature, so the first step required - repack this seemingly non-

Operation with the key actually
jarsigner-keystore myKeystore demo.jar ...
Finishing off the format of the Pack200 sign demo.jar
*** / JDK5/bin/pack200 demo.jar.pack.gz demo.jar
Carried out on signing his name demo.jar Pack200 compression, generated demo.jar.pack.gz

*** / JDK5/sample/jnlp/servlet following jar package, mainly jnlp-servlet.jar copy to be published in the web project WEB-

INF / lib / directory, modify the web.xml file web publishing project, all the *. jnlp and *. jar in the url path to locate

jnlp.sample.servlet.JnlpDownloadServlet processing will demo.jar, demo.jar.pack.gz copy to the jnlp or applet path specified through the operation of more than everything ok, maybe you would like to ask jnlp applet needs to be done and what changes you, the answer is no, all by

JnlpDownloadServlet transparent handled, jnlp and applet inside the point or demo.jar, JnlpDownloadServlet

Automatically according to the Accept-Encoding request in the end the decision is issued demo.jar.pack.gz or demo.jar, so if a customer

JDK5 client installed the Java Web Start or Java Plug-in then JnlpDownloadServlet automatically issued Pack200 compressed

demo.jar.pack.gz package, if the client is a JDK1.4 or older environment, then nature will be issued JnlpDownloadServlet

demo.jar common package.

Pack200 the compression and decompression speed is relatively fast, but compression ratio is also very amazing, I was used compressed into packets 4.46MB

1.44MB (0.322%), and the greater the compression ratio with packet based on clear, said that if the jar package are the class categories can be compressed to 1 / 9

Size. In fact JavaWebStart many functions, such as different jar can be downloaded and a separate package for lazy update, set to root

Jar in the class, according to changes in class size for the download. Got it all, hurry to release your weight-loss process it.

[/ Size]

相关文章
  • java create exe installation package Package With JRE from the start 2010-05-05

    [Size = medium] target: as the installed package has been installed next qq can be as simple as can be unloaded, claims process starts automatically, no separate installation of JRE, Just writing this solution, I really hate every means Microsoft. He

  • Use InstallAnywhere7.1 production Java exe installation package (rpm) 2011-08-19

    Use InstallAnywhere7.1 production Java exe installation package Java application development and testing project is completed, companies need to archive this package (ie jar), and made into a commercial installation. 1, in the production into a jar f

  • Java基础教程之包(package) 2013-10-01

    这篇文章主要介绍了Java基础教程之包(package),本文详细讲解了包的创建.使用等方法,需要的朋友可以参考下 我们已经写了一些Java程序.之前的每个Java程序都被保存为一个文件,比如Test.java.随后,该程序被编译为Test.class.我们最终使用$java Test来运行程序. 然而,在一个正常的Java项目中,我们往往需要编写不止一个.java程序,最终的Java产品包括了所有的Java程序.因此,Java需要解决组织Java程序的问题.包(package)的目的就是为了更

  • java generated exe file 2008-08-11

    For Java for desktop applications, the more annoying is the installation of the deployment, the client is installed jre, jre version of the problem, jre where to download, how to use jre start your Java application? Do not say people new to computers

  • Oracle_ process (Procedure) _ function (Function) _ Package (Package) _ Trigger (Trigger) 2010-08-13

    PL / SQL block can be independently compiled and stored back in the database, connect to any database application that can access these stored PL / SQL block. ORACLE provides four types of programs can be stored: Procedures and functions Processes an

  • Java程序生成exe可执行文件详细教程(图文说明) 2014-03-12

    这篇文章主要介绍了Java程序生成exe可执行文件详细教程,有需要的朋友可以参考一下 Java程序打包成exe可执行文件,分为两大步骤. 第一步:将Java程序通过Eclipse或者Myeclipse导成Jar包 第二步:通过exe4j讲Jar包程序生成exe可执行文件 第一步详解: 将java程序生成Jar包 以下是Myeclipse导出Jar包,首先选择项目"右击" 点击"Export" 选择JAR file 只保留项目底下的src目录勾选,config和lib

  • java how to play JAR package (transfer 2010-02-03

    Keywords: jar jar application to first open a command prompt (win2000 or in the implementation of the cmd command to run basket, win98 as the DOS prompt), type jar-help, and then enter (if you already have plate jdk1.1 or above), see what: Usage: jar

  • Java and Json object conversion package 2010-09-24

    Company uses json-lib-2.2.3.jar package to deal with JSON data JSONObject and JSONArray basic use into two types of variables. JSONObject jsonObject = JSONObject.fromObject(strJson); JSONArray jsonArray = JSONArray.fromObject(jsonObject.get("result&q

  • java file with multiple labeled package to download example zip 2011-08-24

    / / Download file package public static HttpServletResponse downLoadFiles (List <File> files, HttpServletRequest request, HttpServletResponse response) throws Exception { try { / ** This collection is packed all the files you want, * It is assumed t

  • java deal with Excel (POI package) 2010-06-03

    Recently in this forum we can always make use of java to see all the problems dealing with Excel, and sometimes the problems related to graphics, We read the article, I think many people would solve the problem! Many articles have been seen online is

  • JAVA packaged EXE file request procedures 2010-04-21

    . Step a) using Eclipse will need to run the main class of the jar labeled packages independently, pay attention to add the manifest properties and MainClass. b) Create a new exe4j project c) Select "JAR in exe" mode d) In the Configure applicat

  • java create xml parsing 2010-11-10

    These days is always someone asked how to use java generate xml file, before also see how others used their own, under their own will probably understand, but we will not be the specific wording, so look for the next under the relevant documentation

  • java create image thumbnails 2011-01-03

    package com.mxo9.b2c.service.administration.impl.goodstrading.goods; import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.MediaTracker; import java.awt.image.Bu

  • Ear on the war package package jar package and packaging method 2011-07-21

    war package: is to do a web application, it is often deployed to a site labeled container package jar package: usually the time to develop a common reference category, labeled package for storage management. ear packages: enterprise applications are

  • linux java unloading and installation 2011-10-05

    1 test java JDK is installed Root user login to the system, open a terminal and type # Rpm-qa | grep gcj Display contains the following information # Java-1.4.2-gcj-compat-1.4.2.0-40jpp.112 # Java-1.4.2-gcj-compat-devel-l.4.2.0-40jpp.112 (the package

  • How to install the proposed (candidate update package) package 2010-05-08

    evince in ubuntu 10.04 I do not like a bug, I found the Internet to say that proposed changes which have been good to have a bug in the installation package. Now look at how to install. Software source inside the first early election on the proposed

  • java create zip archive 2010-10-19

    package javaio; import java.io.*; import java.util.zip.*; public class ZipCompress{ public static void main(String args[]){ try{ ZipCompress zip=new ZipCompress(); FileOutputStream fileOut=new FileOutputStream("Example.zip"); CheckedOutputStream

  • ubuntu Java, tomcat6 manual installation and simple configuration 2010-10-28

    This test environment: ubuntu10.10, jdk6, tomcat6.0.20, ordinary users to install. A, Jdk installation shell> cd DIR shell> chmod a+x jdk-6u16-linux-i586.bin shell> sudo ./jdk-6u16-linux-i586.bin shell> mv jdk-6u16-linux-i586 Java shell> su

  • Eclipse hit a third-party JAR JAR package package can not find reference to the problem. 2011-05-02

    My program is referenced in the other JAR package In ECLIPSE running normal I would like to give my program a JAR package When packaging referenced package is also playing in Run the program can always find my reference package Is path problem ? Sudd

  • jre installation fails, manual registration jre 2010-09-19

    Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT \ CLSID \ (8AD9C840-044E-11D1-B3E9-00805F499D93)] @ = "Java Plug-in 1.6.0_21" [HKEY_CLASSES_ROOT \ CLSID \ (8AD9C840-044E-11D1-B3E9-00805F499D93) \ InprocServer32] @ = "C: \ \ Program