1

I have a project that converts .class files to .java file, during the research I've found that Proycon is a java library that helps to do this. unfortunately I couldn't find any proper documentation for Proycon. anybody having experience using this, if yes please tell me which method I have to use for converting .class to .java file and to print it in to console?

skiwi
  • 66,971
  • 31
  • 131
  • 216
droidev
  • 7,352
  • 11
  • 62
  • 94
  • Was the [home page with a wiki and the author's contact info](https://bitbucket.org/mstrobel/procyon) not sufficient? – Jason C Mar 05 '14 at 06:13
  • @JasonC I think my google couldn't find the link, do you have a link ? – droidev Mar 05 '14 at 06:17
  • Click the link in my comment... it's also the first Google result for "procyon decompiler". – Jason C Mar 05 '14 at 06:28
  • @JasonC I have already read that, but it does not describe about decompilation methods – droidev Mar 05 '14 at 06:33
  • 1
    To anyone using Procyon, do feel free to contact me directly with any questions you may have. I can be reached via BitBucket direct message, Twitter, or e-mail. My contact info is on the Procyon BitBucket page. I also check the `decompiler` and `decompiling` tags regularly on StackOverflow. – Mike Strobel Mar 10 '14 at 18:41

3 Answers3

3

I'm using procyon-decompiler-0.5.30.jar from its Bitbucket repo.

If you need to decompile one or more jars, please copy them to a folder and then run:

%JAVA_HOME%\bin\java -jar c:\procyon\procyon-decompiler-0.5.30.jar -o . *.jar

In the above command I'm specifying the full path to the procyon jar, and the -o . sets the output to the current folder.

Lets say I want to check sentry-logback-1.5.4.jar, after running the above command I will end up in the working folder with the following structure:

sentry-logback-1.5.4.jar
[io]
  `-- [sentry]
          `-- [logback]
                 `-- SentryAppender.java
alexandrul
  • 12,856
  • 13
  • 72
  • 99
  • 1
    Please refer https://stackoverflow.com/a/58711972/5930500 for downloading the jar as it's no more available from Bitbucket repo – nitin angadi Dec 01 '21 at 08:22
1

JD-core-java https://github.com/nviennot/jd-core-java is a thin wrapper of jd-core. the readme file shows how to use it in your project.

/* Returns the source of SomeClass from compiled.jar as a String */
new jd.core.Decompiler.decompile("compiled.jar", "com/namespace/SomeClass.class");

/*
 * Returns the sources of all the classes in compiled.jar as a Map<String, String>
 * where the key is the class name (full path) and the value is the source
 */
new jd.core.Decompiler.decompile("compiled.jar");

/*
 * Returns the number of classes decompiled and saved into out_dir
 */
new jd.core.Decompiler.decompileToDir("compiled.jar", "out_dir");
Chamil
  • 805
  • 5
  • 12
  • I have implemented this method it caught an exception "java.lang.UnsatisfiedLinkError: Can't load library" – droidev Mar 05 '14 at 10:03
  • This is due to some missing library. refer to below link as a troubleshooting guide. http://stackoverflow.com/questions/1403788/java-lang-unsatisfiedlinkerror-no-dll-in-java-library-path – Chamil Mar 05 '14 at 17:13
  • the problems is the given github source code is wrapper for linux, I am working in windows, do you have Windows wrapper ? – droidev Mar 11 '14 at 08:29
0

Download Java Decompiler(JD) to convert .class file to to .java i have used this Decompiler it is best in my opinion

Engineer
  • 1,436
  • 3
  • 18
  • 33