Java Project References Java project

Source: Internet
Author: User

Description: The following example uses the Eclipse development tool.

When writing large-scale Java project, it is common to refer to some other Java project (the purpose: to avoid duplication of code, improve the rate of reuse of code), there are two ways of reference (assuming the original project is Baidu, you need to refer to the project is P, that is, p to reference Baidu Project):

Method 1: Make the Baidu project into a Baidu.jar, and then put it into the class library of project B;

Disadvantage: Can not view the source code of Baidu Project;

Method 2: Direct Baidu Project into p, the specific steps are as follows:

<1> Click P Project Right---->build path--->configure Build path ...

<2> Select projects, such as

<3> Click the Add button to select the items you want to add or import in the following screen

<3> This allows you to refer to project A in the new project (that is, the Baidu project in the diagram).

The class presentation in the Baidu project----p refers to the Makecomplexmap method inside the Maptest.java:

Quote Baidu in Project P

Select Maptest, click F3, you can see the source of Maptest.java.

Java Project References Java project

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.