How to use code in eclipse projects

I have two applications: one for android and one for Blackberry, and I want to share some common code between two applications.

I have a folder structure as follows ...

project
    android
        .metadata (eclipse workspace)
        project
            (android specific project folder layout)
    blackberry
        .metadata (eclipse workspace)
        project
            (blackberry specific project folder layout)
    project.core
        src
            (just source files common to each project above)

I just want to reference the external source folder (using relative paths) from two internal projects. Eclipse does not seem to like this setting because it prefers the source folders to be children of the workspace folder. For other reasons, I cannot share a common workspace between BlackBerry and Android.

Is there any way to do this?

+5
source share
2 answers

. .

+5

, : , , .

The file system layout:

EclipseWorkspace
   project1
      src
         com
            myApp
               Package
                  myActivity.java
               Shared
                  mySharedClass.java

   project2
      src
         com
            myApp2
               Package
                  myActivity.java


The resulting file layout from the Eclipse Package Explorer view:

project1
   src
      com.myApp.Package
         myActivity.java
      com.myApp.Shared
         mySharedClass.java

project2
   src
      com.myApp2.Package
         myActivity.java
      com.myApp.Shared       NOTE: this folder icon has a link arrow in it.
         mySharedClass.java

project2,, :

  • project2 src .
  • "" > ""
  • "" " " ( " " ).
  • ""
  • WORKSPACE_LOC ""
  • project1 src/com/myApp/Shared OK
  • , , . com.myApp.Shared Finish
+1

All Articles