I am having one .java file containing two classes out of which one is public class. I am using methods of that class in more than one java projects created in eclipse. I want to share that file keeping at fix location like referencing common .h and .cpp files in more than one projects in visual studio in more than one projects. So separate copy of that file should not be present in eac开发者_如何学Ch project. Is there any way to do this in eclipse?
Build that java file to library (*.jar) and add it to the project where you want to use it
See Also
- Creating a jar file
- How-can-i-create-a-jar-file ?
Create a jar file and put it to your projects as a library.
If you dont want to build the jar, then you can add the project containing that class to the project dependencies of the projects where you want to use the class.
精彩评论