Basic introduction
Jar packages are some classes that others have written, and then package these classes. You can introduce these jar packages into your project, and then you can directly use the classes, attributes and methods in these jar packages.
JAR (Java ARchive) combines a series of files into a single compressed file, just like Zip. However, like everything else in Java, jar files are cross-platform, so you don't have to worry about platform-specific issues.
JAR files are particularly useful when it comes to Internet applications. Before the JAR file, the web browser must repeatedly request the web server to download all the files that constitute an "applet". Otherwise, every file is uncompressed. But after merging all these files into a JAR file, you only need to make a single request to the remote server. At the same time, due to the use of compression technology, all data can be obtained in a shorter time.
How to use
1. Right-click "Project" → select Properties, select Java Build Path in the list on the left side of the pop-up dialog box, select "Add Library" in the pop-up dialog box, select "User Library" in the pop-up dialog box, and then select → Next
2. In the dialog box that appears, you can select the user-defined library that has been created, or select User Libraries. Select "New" in the new dialog box that pops up to create a new user-defined library.
3. In the user-defined library to be created, enter the name of the new custom library.
4. Then add the required Jar package for the new library
5. After adding user-defined libraries according to the above steps, you can reuse these defined User Libraries in the future to save time for development.
FAQ
How to solve the problem that sun.misc.BASE64Encoder cannot find the jar package?
1. Right-click the project-"Properties-"Java bulid path-"jre System Library-"access rules-"resolution select accessible, fill in ** below and click OK! ! !
2. When writing Java code in MyEclipse, BASE64Decoder is used, import sun.misc.BASE64Decoder; but Eclipse prompts:
Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:Program
filesjavajre6librt.jar
Access restriction: The constructor BASE64Decoder() is not accessible due to restriction on required library C:Program filesjavajre6librt.jar
Solution 1 (recommended):
Just remove the JRE System Library in the project build path, then add the library JRE System Library, and everything will be normal after recompiling.
Solution 2:
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings ->
Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning
internal preview
it works
it works
it works