1

Possible Duplicate:
Android project unable to reference other project in eclipse

I have an eclipse java project. I don't see a bin directory. It has an application and it runs fine. However, I have problem. I need to include some of those classes in another project, namely an Android java project. So there are two things I really don't understand how to do:

1) Specify an output folder so there is a real visible bin directory in this project?

2) auto generate a .jar file with these classes so that I can include the jar file in another project.

Yes, I am an experienced programmer, and no it is not at all clear to me how to do this looking at the options under project properties. Including just the whole project works for compiling, but at runtime the classes from the java project are missing.

Community
  • 1
  • 1
Code Droid
  • 10,344
  • 17
  • 72
  • 112

1 Answers1

2

1) Specify an output folder so there is a real visible bin directory in this project?

The directory is there, but Eclipse hides it by default. If you want to see it, you will first need to switch to the 'Resource' perspective (Window -> Open Perspective -> Other..., then select "Resource" and click OK). From there, click the downward triangle button in the Package Explorer view (top-right corner), then select "Customize View..." from the dropdown menu. Deselect the "Java output folders" option and click OK.

If you want to change the location of this directory for whatever reason, right-click any Java project, the select "Build Path" -> "Configure Build Path". The location of the output directory is specified in the "Source" tab.

2) auto generate a .jar file with these classes so that I can include the jar file in another project.

As mentioned in Code Droid's answer, a better option is usually to modify the build path to include the project that contains the files as a dependency. However, if you really need the jar file, one easy option is "File" -> "Export...". Under "Java", you'll find "JAR file" (or "Runnable JAR file", if you want to make it executable using the -jar option). Once you select the classes you want to include, click "Next", and you'll have a chance to save the configuration so that you can easily perform the same export operation in the future.

Bruno Dufour
  • 126
  • 1
  • 3