[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
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
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:
Packer packer = Pack200.newPacker ();
OutputStream output = new BufferedOutputStream (new FileOutputStream (outfile));
packer.pack (new JarFile (jarFile), output);
Unpacker unpacker = Pack200.newUnpacker ();
output = new JarOutputStream (new FileOutputStream (jarFile));
unpacker.unpack (pack200File, output);
More details, see the following URL:
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.
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
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
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.