Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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: 16083
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: 59110
180
  • 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: 16083
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: 59110
180
  • 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: 59110
180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!