• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you go: File -> Export -> Java - JAR file, on the next screen check "Export java source files and resources"
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic