Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java JAR file - Can I view .java classes

 
Glen Iris
Ranch Hand
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have just been given the task of extending an existing java application. The current application is run by executing a jar file.

My question is - can I get my hands on the .java files and add functionality just by doing something to the .jar file?

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally not, the jar file will just contain the compiled code, not the *.java source files. You'll have to find out where to get the source code of the application.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A .jar has the same format as a .zip (plus a manifest file). So you can easily unzip it. The Java™ Tutorials section has a subsection about "extracting", which should help you.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but it will normally not contain the source files of the program.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I missed that bit. Best to contact the original supplier to request the code.
But you ought to be able to extend classes without seeing their source code. You only need to read their documentation, created with the javadoc tool.
 
Glen Iris
Ranch Hand
Posts: 172
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats what I suspected but didnt want to look the fool in front of my new employers. Thanks guys!
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic