What do we do when we write a paper and find that we do not have a plan? Very simple, the next PS to engage, after the finished, but now on the Internet next PS is not simple, do not believe you try, all kinds of garbage software, under the test version, this time you want a free installation version of the Green PS Ah, today we will explain how to use Eclipse green packaging. Green packaging than ordinary packaging trouble not too much, the user reduced the trouble must be added to your head is not. This is the first blog I wrote, the park is late, just start work sometimes idle to share the next experience, also prepared to forget when the view. Many places are ill-conceived and not shown, we will have a question to leave a message, OK, below to get to the point
First, introduce the final result
1. Eclipse above required:
(1) pq.ant
(2) Application and server each have a manifest
2. Folder contains:
(1) Client folder
1~pq. Application
2~lib folder with a third party rack package
3~lib_nari folder with reference rack package inside
4~ other configuration files, such as Clinetproxycontext.xml, etc.
5~start.bat Startup program
(2) Server folder (can only be installed on server side)
1~pq. Server
2~lib folder with a third party rack package
3~lib_nari folder with reference rack package inside
4~ other configuration files, such as JDBC, config, etc.
5~start.bat Startup program
Second: The specific operation process
How to make the MANIFEST.MF in application:
(1) in the pq.application below the SRC, the new file, named MANIFEST.MF;
(2) First line version number: For example manifest-version: Space 1.0
(3) The second line, such as created-by: space Fat Xu Eclipse plug-in (yellow part is required)
(4) Third line, entry: for example main-class: space Com.nari.slsd.hd.pq.mainApp.main, that is, where the main function
(5) Line fourth, rack package. Places to be aware of
Note: (4) and (5) can be interchanged
The rack package consists of two parts, the third party rack package and the Reference rack package in the Client, application
Reference Rack Package: Right-click Application->properties->java build Path->projects
Inside all the rack packages, and reference rack packages referenced by the rack package
Format: Space folder name/rack package name. Jar Spaces
For example:
Space LIB_NARI/HD. Client.jar spaces
Space LIB_NARI/HD. Client.chart.jar spaces
Third-party rack package: Right-Application->properties->java build path->libraries(requires the same as a reference rack package)
Inside all the rack packages, and reference rack packages referenced by the rack package
Format: Space folder name/rack package name. Jar Spaces
For example:
Space LIB_NARI/HD. Client.jar spaces
Space LIB_NARI/HD. Client.chart.jar spaces
In particular, the first line of formatting:
Class-path : spaces. Space Lib/batik-all-1.7.jar Spaces
Here the order of the package is written according to the default program, such as running errors, and then change the corresponding order, may be adjusted in several order.
How to make MANIFEST.MF in server:
The requirements are exactly the same as in the application, just write the contents of the server.
Pqant.xml Production Method:
(1) Create a new pqant package and build a Pqant,xml file inside it.
(2) First line, version number: For example: <?xml version= "1.0"?>
(3) Second line, project name: For example: <project name= "XZ firstproject" default= "Doc" >
(4) below, give the required package naming and positioning, for example
<!--properies--
<property name= "HD. Base.dir "value=" D:/hddev "/>
<property name= "HD. Brl.classes.dir "Value=" ${HD. Base.dir}/hd. Brl/bin "/>
<property name= "HD. DAO.classes.dir "Value=" ${HD. Base.dir}/hd. Dao/bin "/>
<property name= "HD. Client.classes.dir "Value=" ${HD. Base.dir}/hd. Client/bin "/>
The order doesn't matter, and the space doesn't matter.
(5) Create a new folder, separate files: (There is no third-party rack package, is to add the third-party package to manually)
<property name= "Dist.dir" value= "d:/pq_release/"/>
<mkdir dir= "${dist.dir}"/>
<mkdir dir= "${dist.dir}/client/lib_nari"/>
<mkdir dir= "${dist.dir}/server/lib_nari"/>
(6) Initialize, compile, debug, package
<!--initialized--
<target name= "Init" >
</target>
<!--Compilation--
<target name= "Compile" depends= "init" description= "compile the source files" >
</target>
<!--Commissioning--
<target name= "test" depends= "compile" description= "Run JUnit Test" >
</target>
<!--packaged as Jar--
<target name= "pack" depends= "test" description= "make. jar file" >
<delete>
<fileset dir= "${dist.dir}/" includes= "*.jar"/>
</delete>
(7) Output package (do not need to exclude points as far as possible)
<!-Output HD.DAO.jar--
<jar destfile= "${DIST.DIR}/HD. Dao.jar "Basedir=" ${HD. DAO.classes.dir} ">
<exclude name= "**/*.properties"/>
<exclude name= "**/*.resx"/>
<exclude name= "**/*.xml"/>
</jar>
<!--output HD.Brl.jar--
<jar destfile= "${DIST.DIR}/HD. Brl.jar "Basedir=" ${HD. Brl.classes.dir} ">
<exclude name= "**/*.xml"/>
<exclude name= "**/*.properties"/>
</jar>
(8) Step (7) has been output, the following will be divided between the client and server-side folder
<target name= "Doc" depends= "pack" description= "Create API Doc" >
<!--Client/lib_nari--
<copy file= "${DIST.DIR}/HD. Client.Chart.jar "tofile=" ${DIST.DIR}/CLIENT/LIB_NARI/HD. Client.Chart.jar "/>
<copy file= "${dist.dir}/hd.client.common.jar" tofile= "${dist.dir}/client/lib_nari/hd.client.common.jar"/>
<copy file= "${DIST.DIR}/HD. Client.Control.jar "tofile=" ${DIST.DIR}/CLIENT/LIB_NARI/HD. Client.Control.jar "/>
<!--Server/lib_nari--
<copy file= "${DIST.DIR}/HD. Brl.jar "tofile=" ${DIST.DIR}/SERVER/LIB_NARI/HD. Brl.jar "/>
<copy file= "${dist.dir}/hd.common.jar" tofile= "${dist.dir}/server/lib_nari/hd.common.jar"/>
Here Pqant.xml has been completed, the main problem is more cumbersome, need to be very careful.
After the completion of the operation, if not reported errors, is the basic success
Server and Client startup methods:
Create a new text file in client and server, rename Start.bat, inside write
Java-jar PQ. Server.jar
Pause
Obtain the configuration file:
The application and server inside the configuration file, copy to the corresponding folder, and the PQ.server.jar and PQ.Application.jar two packet resolution to the corresponding folder.
Obtain a third-party rack package:
In application and server to build a folder, the third party rack package to find and take a test, the work here can be with the front pqant.xml and manifest at the same time
Three, on-site installation:
(1) First on the server side, install the client and server, the JDBC and config IP tuning to the server IP, and the server has been started
(2) Back Up database data and restore it on server side database
(3) Install the client on clients, adjust IP and run
Java Green Packaging know how much