0

I use Eclipse IDE for my Java projects and all my projects(Project_1,Project_2 and so on) related classes are inside a package package_name.

I am currently working on 2 classes.

class_name.java(Project_2/package_name)

utility.java(Project_1/package_name)

All methods are public. How can I use the methods within utility.java in class_name.java ?

Sandeep Chatterjee
  • 3,220
  • 9
  • 31
  • 47
Keir Simmons
  • 1,634
  • 7
  • 21
  • 37

2 Answers2

0

You can create a jar file from the source package and import it in the classpath of Project_2.

1- Right Click on desired package -> Export -> JAR File

2- Right Click on goal project -> build path -> Add external jar(or copy the jat file in lib folder of the second project and select the Add Jars in the Libraries tab of Java Build Path)

Hosein Masbough
  • 431
  • 1
  • 4
  • 19
0

If only one requires the other, you can use the Java Build Path property page of one project (Project 2) to have it require the other.

nitind
  • 19,089
  • 4
  • 34
  • 43