1

I am using NetBeans 6.8.

I have a class ClassA situated in PackageA in JavaApplicationProject1.

I plan to use this class in ClassB situated in PackageB in JavaApplicationProject2 just by importing it. One option is to copy ClassA in PackageB, but I don't want to copy. How can I do this?

5
  • 3
    create a jar file of JavaApplicationProject1 and use it as dependency in JavaApplicationProject2 Commented Jul 15, 2013 at 15:04
  • or use Maven. Much much easier. You would then be able to make use of your libraries using any IDE. Just a thought. Commented Jul 15, 2013 at 15:09
  • If your problem is resolved, please accept the answer that helped you most. Commented Jul 15, 2013 at 21:45
  • How do I accept the answer? I don't have sufficient reputation. Commented Dec 16, 2014 at 6:22
  • @JavaFreak stackoverflow.com/help/someone-answers Commented Apr 3, 2018 at 11:20

1 Answer 1

10

Under Project Properties -> Libraries -> Compile -> Add Project you can add project dependencies. So adding JavaApplicationProject1 as a project dependency in JavaApplicationProject2 will do what you want. Details can be found in this guide

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.