I add and remove some classes during editing a Java library project.
E.g., I added the two classes.
- Dummy1.java
- Dummy2.java
Then I right-click the source folder (src
where all the packages are) of my library project and export it to a JAR. I check the 'Export Java source files and resources' checkbox when I export the library.
Then I right-click a client project which uses the library and add the JAR like this.
Properties > Java Build Path > Tab: Libraries > Add JARs...
Dummy1
and Dummy2
can be used in the project.
After that I add Dummy3.java
to the library project and modify Dummy2
, Then I export the library to the JAR again.
Now I can use Dummy1
and Dummy2
(except my last modifications) in the client project. Dummy3
will be accessible after removing and re-adding the JAR to the client project through Properties. If I have one or two clients, it'll be OK to add the JAR every time. But if five or seven clients use it, I'll take me a lot of time to remove and re-add after adding a variable to a class of the library project.
Update #1.
An Android project and a GWT project use the library.
Update #2 (it works for the Android project).
I have successfully added a JAR to the Android project.
- I edited a class in the library project.
- I exported the library to a JAR.
- I manually copied the JAR to the Android project's directory.
- I can use the last changes of my library in the Android project.
The guides were helpful.