Reputation: 61
Here's the deal. I'm fairly new to Java and I have these three .java files that I need to compile into one .jar executable.
Each file has it's own JFrame and the thing is I need to make an action in ho.java open the JFrame in read.java and another action in ho.java open the JFrame of write.java.
In eclipse, how would I go about doing this? I've seen topics where people want to know how to combine multiple jar files into one, but I wonder how to compile multiple .java files into one .jar file.
If it's impossible, then how should I interconnect these three files?
Upvotes: 0
Views: 2577
Reputation: 67
Put all your files in a folder in your Eclipse project and then:
- Right click in your folder
- Export
- Java -> Runnable JAR File
Upvotes: 0
Reputation: 41281
Simply, you can export them.
In the package explorer, select all of the necessary java files wit Ctrl+click, right-click the selection, and select "export"
Continue through the wizard, selecting Runnable Jar file or Jar File to your liking, select the export directory, and finish. You are done.
However, if you selected to export the ant buildfile, you can reuse it with a builder. Right-click your project, and select properties.
Under "builders", add a new builder as shown here:
Its type should be an ANT builder.
For the buildfile, select browse workspace or browse filesystem(depending on where you exported it) and select the .xml file you exported previously. You can now do Project->Build and your Ant build will occur as part of the build process.
Upvotes: 2
Reputation: 22084
If they are in the same project, then you can simply right click on your project in the popumenu select Export...
In the following Dialog you go to Java -> Runnable JAR File
Upvotes: 2