This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes including source in JAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "including source in JAR" Watch "including source in JAR" New topic

including source in JAR

greg buela
Ranch Hand

Joined: Sep 04, 2007
Posts: 71
How do you tell the compiler to include the source files in the destination JAR, along with the bytecode?

SCJP 1.5
Henry Wong

Joined: Sep 28, 2004
Posts: 18498

The compiler doesn't generate the jar file -- the jar packager does that. And that tool doesn't care what you add to it. If you want the source in the jar file, just add it to the args list of files to be included.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
greg buela
Ranch Hand

Joined: Sep 04, 2007
Posts: 71
Thanks, I got it. My IDE was set to exclude .java files when packaging.
I agree. Here's the link:
subject: including source in JAR
Similar Threads
The import org.apache.xmlrpc cannot be resolved
PLS help me about file access!!
How to create Executable jar file.
Debugging in WSAD5.0
read a source from a jar file