import ... public class TriggerJob { String jobStatus = ""; SchedulerMetaData metaData = null; public void rightNow(HashMap ParamMap){ AnotherProjectClass anp = new AnotherProjectClass(); anp.display(); } }
If you want to use the sources from one project in another project in Eclipse, do not just add a class folder. Instead, define a dependency on the other project. To define that project P2 should use the sources/classes of project P1, open the project settings of P2, and go to "Java Build Path".
Step 1: Open Eclipse and click File > New > Java Project. Step 2: Provide the Project Name and click on the Finish button. Step 3: In the Package Explorer (left-hand side of the window) select the project which you have created. Step 4: Right-click on the src folder, select New > Class from the submenu.
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.
Knowing that you using any version of Eclipse, the below steps should help you:
Step #1. Right Click => Project
Step #2. Click Project Properties
Step #3. Click on Java Build Path
Step #4. Click the Projects Tab
Step #5. Click the Add Button
Step #6. Select the Project you want to add
Step #7. Click OK button
Hopefully this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With