Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
528 views
in Technique[技术] by (71.8m points)

Can we call another project java class from our project in eclipse

import ...

public class TriggerJob {

    String jobStatus = "";
    SchedulerMetaData metaData = null;

    public void rightNow(HashMap ParamMap){ 

AnotherProjectClass anp = new AnotherProjectClass();
anp.display();

}
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can do either this way:

In the dependency you can add the other projects to your project. Right click on project -> properties -> java build path -> projects. Add your project here.

OR

Make the classes of project into jar and add it to other project

Dependencies should be added in classpath

In run time, make sure the JAR files of the referenced projects is added in class path on both the cases.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...