Reputation: 4098
A Java newbie here. I have created a small desktop application in IntelliJ IDEA 11.1. It consists of several java files with classes plus the main application file Main.java. I would like to make another application, which uses the same classes but a different Main file. I want to be able to change the classes source code from both projects. Therefore I'd like to have a structure like:
IdeaProjects\lib/myclasses\*.java (or similar with additional src if recommended)
IdeaProjects\project1\src\Main.java
IdeaProjects\project2\src\Main.java
How do I do it properly? I've read a lot about modules, libraries, jars and am just lost at the moment :(
Upvotes: 1
Views: 397
Reputation: 725
I don't use IntelliJ so I can not help you specifically but You should create one project containing the shared resources and per program another project containing you Main files. Compile this first project into a jar file so you can use it as a library in the projects containing the main files.
In eclipse You can add other projects to your classPath. Maybe this is also possible in IntellyJ.
Upvotes: 1