This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Java JAR file - Can I view .java classes  RSS feed

 
Ranch Hand
Posts: 175
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?

 
Java Cowboy
Sheriff
Posts: 16084
88
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.
 
Marshal
Posts: 60068
188
  • 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
Sheriff
Posts: 16084
88
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
Marshal
Posts: 60068
188
  • 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: 175
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
Marshal
Posts: 60068
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!