Decompile class files to view its source code in eclipse
Many times, while developing a project, we come across a situation, when we want to see the source code of library we are using, for better development or in some cases while debugging. But libraries are consist of class files only, and if you try to open it, editor will ask for its source files, or it will open some garbage values which are not in human readable form.
So, here is the rescue: We can add a decompiler plugin and set it as a default editor for class files and class files without source code.
How to do that, is shown below:
Now, you can view decompiled source code of any class, in eclipse just with a ctrl+click. Enjoy J
So, here is the rescue: We can add a decompiler plugin and set it as a default editor for class files and class files without source code.
How to do that, is shown below:
Install Enhanced Class Decompiler from eclipse Marketplace.
Choose your decompiler preference:
Go to Window > Preferences > Java > Decompiler, Here you can choose which decompiler, you want to use, FernFlower is default one and mostly preferred too.Associate File Editor with .class extension
Now, Go to General > Editors > File Associations.
In File Types, select class without source and then in associated Editors tab, select Class Decompiler Viewer and mark it as default. Prior to it, generally class file viewer is marked as default.
Now, you can view decompiled source code of any class, in eclipse just with a ctrl+click. Enjoy J



Comments
Post a Comment