1 Preface
When you write your own common classes, in order to facilitate their import these common classes, you can pack the class files of these common classes into a jar file and then configure it into the classpath. 2 method of jar package compression
First into the package parent directory of these classes (such as the package of these classes is net.csdn.blog.jexhen, then we should go to the directory above the Jexhen directory), and then enter the command line
JAR-CVF Test.jar *. *
Test.jar This name can be casually, as you like, also pay attention to the space between the command line, the first "*" and ". *" between the space, meaning that the folder and files are compressed into the jar package
Other parameters can be typed jar return at the command line view 3 classpath configuration Method
Put the jar path of the person into the environment variable classpath (if the Test.jar on the path is D:\test\, then we should add D:\test\test.jar in the environment variable classpath)
Then we can import our own common classes in the source code we write, assuming that my jar package class has a test class, so I can import the class like this:
Import Net.csdn.blog.jexhen.Test;
public class Testjar {public
static void Main (string[] args) {
test test = new test ();
}
}