Java class packaged into JAR file &&jar package Introduction

Source: Internet
Author: User

Package the class into a jar file

First, look at the source code of Mainactivity.java and Func.java respectively.

Now to package the Func.java into a jar package, here's how:

A, right-click Func.java->export->java->jar file

b, select the class to be packaged in the select the resources to export, and note that if this class has calls to other dynamic/static libraries, it does not need to be selected together, only Java files are selected. The library file can be referenced with the jar in the new project directory. Then enter the Jae name and storage location, click Finish, such as:

At this point, the Func.jar is generated at the specified location


Ii. adding a jar package to the project

A. Put the jar package (and its library file) in the Libs folder (recommended) in the project directory.

b , in Eclipse, right-click the Java Build Path in Project--Properties, enter the Libraries tab

C, stand-alone "add JARS", find the Jar file, add. Ok

D. Directly using the classes in the jar







Java class packaged into JAR file &&jar package Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.