Wednesday, 31 October 2007

* How you can access the class from other project under eclipse

* How you can access the class from other project under eclipse

- Scenario
*** Project1
------ com.ssr1.yy (package)
------------ a1a.java
------------ b1b.java
------ com.ssr2.yy (package)
------------ a2a.java
------------ b2b.java

*** Project2
----- com.rr1.yy (package)
------------ cc1.java


you are supposed developing "project2" with eclipse like above enviroment.

Now you are trying to access some class that is located in "Project1" , suppose it is a1a.java

You want to access or create "a1a.java"(Project1) object from "cc1.java"(Project2)

Then you should customize some of enviroment (MANIFEST.MF) .

1. open MANIFEST.MF from Project1

2. Click "Runtime" tab on the bottom

3. Click "Add" button under "Exported Packages" title

4. select or type "com.ss1.yy" because "a1a.java" file is located under that pacakge name.

5. click ok and save it

6. Compile it
-----------------------
7. open MANIFEST.MF from Project2

8. Click "Dependencies" tab

9. click "Add" button under "Required Plug-in"

10. select or type "Project1" because a1a.java file is located under that project

11. click ok and save it

== Now you can create or access a1a.java file from cc1.java file ====

No comments: