Java is the new darling of the OOP era. It has the charm of other languages. It is this kind of charm is a numerous programmer, and there is always some rookie as my flow, often because I wrote a little Small procedures cannot publish ants on a hot pot. Below is a little bit about publishing a Java program. I hope to meet the possession of the issuance.
Of course, I am here so-called Java program, refers to the release of procedures such as APPLET, Java Severlet, JSP, but merge with Frame, can run separately (refer to a Java virtual environment).
As we all know, Java needs to operate in his virtual environment, which is the foundation of Java's cross-platform, and also adds the user's embarrassment. To run the Java program, you must build a running environment. In fact, this is not difficult, download one from the Sun's website, there is nothing special. However, these are not the problems considered by developers. I am like the rookie mentioned in the following, I didn't consider the Java environment to the user. The knowledge we think put the files, users click on a file. You can run the right. So we have to consider the problem of ClassPath. ClassPath is a more troublesome problem, http://www.9cbs.net/develop/Article/15/15971.shtm is a good article, but I still recommend that beginners use some editing tools, not like I use NOTEPAD for many days like this, which can save a lot of troubles about ClassPath. Here I recommend Eclipse, this is a better tool (of course, when you don't use pirated JBuilder, etc.), and you can download at www.eclipse.org at the same time. Using this platform can create a package as you want, without having to care about environmental variables. But it can't solve the issued problem.
I used to find a post, saying that the Class is packaged into a jar file to let the user run directly, http: //expert.9cbs.net/EXPERT/topic/1995/1995651.xml? Temp = .6288721 But how I also run Come up, but this post also has a lot of help, let me not have to have a multi-fold tongue to describe how to pack it. Of course, if you use Elipse as me, you don't have to care about this problem, remember to choose mainclass when you pack it.
Now we already know how to pack it, so we have a JAR file name, it is called Haha.jar, and this file can run through java -jar Haha.jar so that we only need to write a bat file. This BAT file is only such a java -jar Haha.jar. This way we don't have to care about the user's setting. Just click on the BAT file to run the program you write.
Steps summary: 1. Developer 2, packet 3, write the BAT file 4, put the JAR file and the BAT file to zip or other format 5, put it on the network for others to download.
This document is only commissioned locally. If there is incorrect, please notify the author. Idilent@yahoo.com.cn
Copyright: IDILENT website reproduced please indicate the author's other reprint please contact the author (iDilent@yahoo.com.cn)