This question already exists:
Closed 12 years ago.
Possible Duplicate:
Where can I find a Java decompiler?
Can anyone tell me how i can convert jar file to it's corresponding .java source file?
I have jar file from unknown source. Is it possible to get the corresponding .java source file out of jar?
You can use java decompiler
In principle you can decompile any jar file, by using ,for example, JAD
http://en.wikipedia.org/wiki/JAD_%28JAva_Decompiler%29
But if the jar was obfuscated the result may not be very pretty. ;)
My fav decompiler is cavaj, you can download from the following url
http://cavaj-java-decompiler.en.softonic.com/
Normally are in a "jar" archive only the compiled Java files (". class"). But you could theoretically try to decompile these files.
Here you'll find e.g. a decompiler
Related
This question already has answers here:
How do I make a JAR from a .java file?
(8 answers)
Closed 6 years ago.
I just have some (134) .java source files with me and I'm pretty sure that contains all the necessary code!
I want some quick tutorial to compile this program into a .jar file.
(I'm on a windows platform btw)
I have tried javac and jar commands. I got my .jar file but it's not opening!!!
Thanks in advance!
Best practice is to make use of Ant/Maven/Gradle kind of build program tools that can take care of creating Jar files.
Other way is to just make use of Eclipse's feature for exporting the project as a light weight Jar file or Runnable Jar file(which includes dependencies).
Place all the files you want to include in the JAR file inside a
single folder.
Open the command prompt in Admin Mode
Navigate to the folder where you stored your files.
Set the path to the directory of the JDK bin. You will need to run
the jar.exe utility to create a JAR file, and that file is located
in the bin directory.
Create the JAR file.
The format of the command line for creating the
JAR file looks like this: jar cf 'jar-file'.jar input-file(s)
You can use WINRAR.
right click on file (put inside all your .java files) and compile by using winrar;
choose format .zip (important)
and save filename.jar (important)
This question already has answers here:
Java creating .jar file
(5 answers)
Closed 8 years ago.
I decompile jar file using jd-gui app. I made some changes on it.
After that i try to compile main.java file which one include all packages & other java files.
Then it Shows classnotfound exception.
I need to it without using any IDE.
Please Help me.
Thanks in advance.
A JAR (http://en.wikipedia.org/wiki/JAR_%28file_format%29) file is a ZIP-compatible archive of your compiled classes and other binary resource.
Feel free to unpack/pack it or treat it the way you treat ZIP-archive, say using your favorite archiving tool, like 7zip.
You can even create a ZIP archive with the contents you wish your JAR to contain and simply change the file extension to .jar.
NOTE: in case you use compression for your ZIP-archive, because in that case your manifest often must be the first entry in the archive.
This question already has answers here:
Is there an easy way to attach source in Eclipse?
(17 answers)
Closed 7 years ago.
I have attached the source code of rt.jar file ie src.zip to my Eclipse.
My problem is that, After adding the source code of rt.jar to eclipse, when I open any class,for Example "String" class, The eclipse itself showing ".class" file for "String" only,It does nopt showing ".java" file for "String".
How can I see the ".java" file?
The source file is exactly that, the source file. You are reading the files in the .jar. Adding the source is not a magical way in which you can edit the .jar. If you could change the underlying Java source code it would be one of the biggest security risks. The .class file is a representation of the .java file and as such there is also no reason for you to need the .java file.
Did you try to attach the source code, as shown in the below screen shot.
This question already has answers here:
How can I open Java .class files in a human-readable way?
(17 answers)
Closed 9 years ago.
How can I open a .class file in Windows 7? I am getting a message saying that I can't see the file and that I have to choose a program to open it or look online for one. Is there any website, explanation, or download that will allow me to access ANY .class file I have extracted or have saved in my Documents?
Are you trying to decompile the .class file and view the source code? You can use Java Decompiler. It has a standalone GUI and also plugin for Eclipse/IntelliJ.
Is there any website, explanation, or download that will allow me to access ANY .class file I have extracted or have saved in my Documents?
It depends what you mean by "access" or "open". It also depends what you mean by extracting ... and what you extracted them from.
If you are trying to run the class files, then the standard way to run a Java application is to use the java command, as documented on the Oracle website. For example: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html. But how you use it depends on the nature of the thing that you downloaded and / or extracted. (Some ".class" files are not applications. Some ".class" files are designed to be run without extracting them from their JAR file container.)
If you are trying to look at the code in the class files, you could use the javap command to disassemble it. Or you could use a third-party tool to decompile it. But unless you have a clue as to what you are doing, this is not likely to help much. And since I can't really guess what you are trying to achieve, I can't offer you any useful references.
If you are trying to do something else, you'll need to explain what it is.
Either way, you need a Java installation on your machine before you can do anything.
You can use the javap command to view the disassembled class file. It is included in the JDK.
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Where can I find a Java decompiler?
How to decompile a whole Jar file?
I have a .jar file. Its a single file, but I want to "decompile" it to get at the original java code (or at whatever would be closest to the Java code - something I could understand, and edit). I believe my file is (specifically) a java applet, but its saved as an executable jar file (.jar).
How would I do such a thing?
Take a look at Java Decompiler.
It allows you to decompile jar files with the JD-GUI and browse the class files as source.
Here is another stackoverflow question.