This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes IDEs, Version Control and other tools and the fly likes How Can I Create a Runnable JAR File in Eclipse, Including Java Source Code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "How Can I Create a Runnable JAR File in Eclipse, Including Java Source Code?" Watch "How Can I Create a Runnable JAR File in Eclipse, Including Java Source Code?" New topic
Author

How Can I Create a Runnable JAR File in Eclipse, Including Java Source Code?

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Hello,

I'm trying to create a runnable JAR file using Eclipse. I am successfully creating a runnable JAR, but I want to easily be able to include all of my source-code within the JAR. Now, when I look at the JAR files that I'm creating, they only have .class files in them.

Thank you for taking the time to read my question.

-- Kaydell
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Here you go: File -> Export -> Java - JAR file, on the next screen check "Export java source files and resources"
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

If I go to:

File > Export > Jar

then I don't get a runnable JAR. I'm going to:

File > Export > Runnable Jar

and I don't have the option to include the source-code.

I guess that I'll have to do as you say and go to:

File > Export > Jar > and then choose to include the source-code, but then I guess I'd have to make my own manifest file so that the JAR is runnable.

Right?
Haina Minawa
Ranch Hand

Joined: Oct 13, 2011
Posts: 119
Kaydell Leavitt wrote:
I guess that I'll have to do as you say and go to:

File > Export > Jar > and then choose to include the source-code, but then I guess I'd have to make my own manifest file so that the JAR is runnable.

Right?


I think you have not tried yourself, because on the next screen you will be instructed to create the manifest file as well as specifying the main class.
 
jQuery in Action, 2nd edition
 
subject: How Can I Create a Runnable JAR File in Eclipse, Including Java Source Code?