How to decompile a plugin in eclipse - java

I have recently started learning to develop minecraft plugins and heard a good way to learn is to decompile other plugins and then learn what the code inside them does but i looked it up and could not find a way to do that.

If you would like to decompile plugins, I would recommend using a program called Luyten. You can open up jar files and see whats inside and see the code. Keep in mind, some plugins may be obfuscated and decompiling some plugins may be against the developer's TOS. If you are in the clear, you can open up a jar file in Luyten by dragging the file onto the window and you can have a look at the code there. But if you would like to edit the code in something like eclipse, you can click the 'File' tab up the top right and click 'Save All'. Then extract all the files inside the zip file and then open up the project in eclipse.

Like #exro mentioned before, you should use Luyten to decompile the code first and be aware of the developer's terms of service and the copyright licensing of the code as sometimes attempts to re-create/decompile the code will be considered a violation of their copyright and could get you into legal issues.
#exro has done quite a good job explaining how to do it on Luyten, though I'd personally like to recommend that you check out github.com and have a look at some of these projects.
https://github.com/ElevatedDev/Frequency
Frequency is a Spigot open-sourced Anti-Cheat made by a few developers and the licensing should enable you to re-create the code in Eclipse without any legal difficulties though this should not be considered legal advice (Please also note that Frequency is created in IntelliJ and Maven so I would recommend that you either learn how to use those tools or just be aware of what they are).
https://www.youtube.com/watch?v=wysn_pFhcmE&list=PLdnyVeMcpY79UFZFfqwaXF2GUGc0v3YyG
This is a beginner-friendly Bukkit/Java coding course which will get you over the first few projects you'll do.

Related

is it possible to set the java decompiler to very verbose

Is it possible to set the java decompiler to return everything it finds during the process? I have a game I have been working on for a little over a year, I am still pretty new to java and have been beating my head against the keyboard and api documentation to produce this game. I come home from a business trip and find that my house has been broken into and my workstation is gone. I still have my keystore because I keep it on a flashdrive for safety. I also keep my project files on a flashdrive, which I did not remove from my workstation before leaving on my trip. I have tried to use every .apk decompiler I can find to recover my source code. They all return some code but of course because of proguard almost all of it is unusable. I have a copy of my signed .apk on my phone for testing purposes and it is debuggable, is there anyway to recover all of my project files from this? Like setting the java decompiler to very verbose, or a different setting that will produce a 1:1 copy of each file reguardless of if the decompiler thinks it is relavent?
Edit: I have used dj java decompiler, androchef decompiler and the decompiler # www.decompileandroid.com which is just a script that is run on their server to use the standard tools included in eclipse adt package for developing android applications.
I used to deobfuscate Java applications for a hobby and have worked on several decompilers, so if you send it to me, I might be able to help.
That being said, there are some things that are simply impossible to fix. You're never going to get back anything that isn't present in the compiled apk because it's impossible to recover information that isn't there. Among other things, this includes comments, original source code formatting, and compile time annotations. The obfuscation step will also strip out class names, variable names, unused methods, etc.
One other thing to try is to see if there's any possible way that a non obfuscated version of apk survived. Did you ever upload your files anywhere else?

Control NetBeans Programmatically using a NetBeans Module

I know I should probably be using Eclipse but whatever...
Usualy at computer science contests I go to, we are given some sample data sets for the problems, such as "prob01.in, PizzaProblem.text, ect.". I am writing a NetBeans Module to make a project and then fill the project with java files of the input files, in the specified location.
So, on to my question. Is there any way to "control" NetBeans, and use it to make and open projects and files?
I did a breif google search and did not find anything useful.
Thanks,
-EpicDavi
http://wiki.netbeans.org/OpenProjectsProgramaticallyInNetBeansIDE#Tutorial_.7C_Open_Projects_Programatically_in_NetBeans
This page only tells you how to open a project programmatically in a Netbeans module, but it should set you on the right path. Unfortunately, I'm not well versed in NetBeans so I don't have much other insight to offer.

Can you use JAXX with Eclipse?

I'm wanting to style Swing components with CSS and saw this as my best bet. But I'm having a bit of a problem just finding out if I can use it with Eclipse?
Is it also practical for a medium sized project, or should I be looking for another way to style components?
Here is the Document for your answer
https://docs.google.com/document/d/19bYF0z5sNiwT-zL5VAZBY1CM0MgHA6pqzZ8dP22llvc/edit?usp=sharing
I am not an expert on a subject of Swing and especially JAXX, but I know a thing or two about Eclipse. If this question is still relevant, you can take my answer as a basis to do some more research.
I searched an Eclipse Marketplace and googled a bit but found nothing about JAXX Eclipse support or plugins. If you know french you can check project's documentation. If there is nothing about tool support in the documentation, I suggest you ask the creators directly.
Eclipse gives you some tools you can use to work with file types JAXX uses. From what I have read here, *.jaxx files are just XML files and stylesheets are just a CSS. I suggest you install XML and CSS support through Eclipse Web Tools Platform and associate *.jaxx files with XML editor either when you first open one of the files with such extension or through File Associations Preferences. In order to compile *.jaxx files you can configure Eclipse Project Builder or use an External Tools launcher.
By the way, have you considered using JavaFX?
#duemir
I have mentioned same thing in my Answer Document.
Please check the Above answer by Me (Jugal Thakkar)
OR
Click on this Link
Go to your Link and Check the Resource in that page and try to go Official Website of JAXX.
You are not able to Go on Official Project Page (www.jaxxframework.org/).
I have mentioned all things in My Document so please first go through that.
I can conclude that on This Question.
1) This Project is not Officially Working. because you can't open official Project Website.
so you are not able to access docs and other stuff.

How to avoid no main class and no class def found error using DropBox and Eclipse for Java

I use Eclipse to write Java code and use DropBox to sync my code with others' across our multiple computers. Most of the time, everything works as expected: if anyone makes a change on either end, the change is saved and when the other person refreshes the Eclipse workspace, the changes come through and can be viewed and run successfully.
Sometimes, one of several errors arises. Sometimes Eclipse says it cannot find a main class and sometimes it says it could not find the class itself. Sometimes it will not report an error but for some reason will not actually update the .class file and therefore run an old version even though the compiler displays the new source code and that saves. I've then noticed that if I manually copy the code into a new .java file elsewhere in the file system and then compile it, it works fine, but for some reason it refuses to regenerate the .class file and I have to delete it manually and replace it with the one generated in the other project--then it works. But for solving the other problems everything needs to be manually copied, deleted, and re-pasted....
[The actual errors include NoClassDefFoundError, UnsupportedClassVersionError, and some other error related to not having a main class.]
I realize that the description here is somewhat vague, but unfortunately I'm not entirely sure what's going on. I hope I'm just missing some basic fact that would help solve all these problems.
Thanks!
I'm sure you will see issues using Dropbox for sharing your source.
Eclipse does not know what Dropbox is doing whilst it's uploading and downloading updates and their activities will certainly not be synchronised. At arbitrary points in time when Eclipse tries to do builds etc. it will find unexpected activity going on, maybe even partially downloaded source files which might explain the specific errors you are seeing.
You're trying to do something more complex than sharing photos or documents. The advice I would give is to use a source control system like git or subversion for source code sharing and control. You can then make use of plugins for Eclipse that are designed to integrate these systems in an easy to use way. There's a learning curve there, but the skills will serve you well.
You can use online versions of these solutions like github and unfuddle if you want to consume sharing, backup and version control of source as a service like you do with Dropbox. They're free, too.
Subversion, Git and all version control software solve all of these problems for you.
Dropbox is not really an adapted system for sharing code. What you should do is set up a SVN, and commit only the source files. This way, you won't have these kind of errors.
Dropbox does have versioning (you can restore old versions of a file), and doesn't seem to be a horrible solution for the problem. I keep my Eclipse repository on Dropbox so it is available on any computer; but since I only use it myself, I haven't encountered your problems.
There is one case I can absolutely see you running into problems--it's if your class files are stored in the dropbox as well. This would just screw everything up. Make sure you specify a location on your local hard-drive for all build artifacts (classes, jars, ...) and that the only thing on your dropbox is the .java sources.
In fact, I suggest you don't keep your eclipse project in your dropbox, just create your eclipse project and point it to the java files in your dropbox.
If this doesn't work for you, go with what other people here said and set up a SVN repository somewhere, it's easier than you would think.
Oh, another possible problem--dates! You may want to make sure the date on your java files isn't jumping forwards and backwards (as might happen if one of your developers were in another time zone). In this case, Eclipse may prefer not to re-compile your file.
Also, instead of the copy/etc procedure you are currently going through, try forcing a project clean.
Response to request for more info:
When you start Eclipse, select/create a workspace that is NOT on your dropbox. The best place is probably off your home directory. If you have already specified a default workspace, there should be a switch workspace item in the file menu.
Create your project. select "Create project from existing source" and specify the source files in your dropbox. I think you want "create separate folders for source and class files" to keep your class files out of your dropbox. If you see anything saying "Copy files into your workspace, say "no".
This should give you a valid, working project. I hope you don't see those problems any more.
One more thing may help--and this may work on your existing project--without the above procedure...
Whenever you refresh your files (f5) to load in changes from the dropbox, select the Project/clean menu and select the project. This should delete all the class files and rebuild them.
If your classfiles are shared on the dropbox, this could still have strange consequences on other people with eclipse open, so I really do suggest rebuilding your workspace as I said above.
How to avoid no main class
Provide one. That issue has nothing to do with DropBox

How do you read JavaDoc? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
What tools/websites do you use to read JavaDocs?
I currently use Firefox with 20+ tabs open when working on a J2EE project to have all the documentation available which is not very usable, is eating too much memory and is not searchable.
What I would expect from such a tool/website:
Aggregate JavaDocs from different locations
Direct access to types like Ctrl+T in Eclipse or similar
Fulltext search
Cross referencing between all the Java libraries I've chosen
For a tool: offline support
Speed
not mandatory:
possibility to annotate things
support for different versions of a library (+ diffing ?)
IDE integration
Edit:
Thanks for your answers. I knew most of the sites but gave them another try. Here is my judgement:
built-in Eclipse/IDE features
tightly integrated
offline/online support
javadoconline.com (no longer maintained)
works
clean looks
finds matches in more than one version of the api and allows easy switching
simple but working
fast
jdocs (offline)
seems very sophisticated
sometimes slow
some recent versions of libraries seem to be missing (Seam 2.0.0, Hibernate Validators) but it looks like you can add them yourself
IDE integration (not tested)
wiki style comments to each item
docjar.com
works
fast
cluttered UI
javadoc_isearch
greasemonkey script for firefox which makes navigating javadocs easier
works smooth and perfectly
JavaDoc jar can be unzipped directly. In theory any released javadocs can be downloaded and viewed offline.
download directly from maven repository. For example: http://central.maven.org/maven2/com/googlecode/objectify/objectify/5.0.3/objectify-5.0.3-javadoc.jar
Now you get objectify-5.0.3-javadoc.jar, rename the file to objectify-5.0.3-javadoc.zip
use your favourite unzip tool to extract it, now you have a folder objectify-5.0.3-javadoc
double click index.html will open the index page on your default browser.
If you use Eclipse, it offers support for Javadocs. For example, hovering your mouse over a method call will display a tooltip showing you the Javadoc for that method. Documentation for the core Java classes are supported out of the box. However, if your project uses any additional libraries (JAR files), some configuration is required in order to plug their Javadocs into Eclipse.
Go to the "Java Build Path" section of your project properties.
Go to the "Libraries" tab and click the "plus" icon next to the JAR file.
Click "Javadoc location", then the "Edit..." button.
This will let you specify where the Javadocs for that JAR are located. It will even let you specify a website URL, so you don't have to download the Javadocs yourself!
You can find Stanford University's JavaDoc here.
I wrote my own tool for this. Acording to my colleagues it is best they seen.
It indexes by lucene once, and run you small server on background, so yo browse javadocs (pydocs, perldocs..) like in browser. It allows also separate libraries per language so searchses like "biginteger" or simialr dont go wrong.
https://github.com/judovana/JavadocOfflineSearch/releases
I use http://www.teria.com/~koseki/tools/gm/javadoc_isearch/ for FF. Lets me easily browse other libraries as well.
Eclipse integrates well with Javadoc and has an HTML-like viewer for it. You can attach source and javadoc to binaries that will show up when you select a class.
Something like this may be useful?
http://www.docjar.com/
Personally, I've never had a problem with the built-in javadoc browsing tools offered by my IDE.
Currently, I use IntelliJ Idea -- Ctl-Q brings up the javadoc for the method under the cursor, with the hyperlinks to other parts of the documentation functional.
I would imagine NetBeans and Eclipse offer similar functionality.
Hm... How about:
http://edu.netbeans.org/quicktour/javadoc.html - NetBeans supports the Javadoc standard for Java documentation - both viewing it and generating it.
http://globaldocs.zeevbelkin.com/ - This application allows to conveniently browse, over the Internet and local filesystem, multiple javadoc sets, using a single packages/classes hierarchy tree and a searchable index. The viewer supports local and remote docsets (the local docsets, packed to JAR/ZIP-files also are supported).
I prefer NetBeans as it get JavaDoc from Maven ~/.m2 directory automatically...
This plug in for Firefox and Chrome is useful for quickly finding package and class names, though it's not a full text search: https://code.google.com/p/javadoc-search-frame/
Eclipse is a best way to see the javadocs. Hovering the mouse on method or any declaration you will get automatically generated javadocs by eclipse.
Doxygen (http://www.doxygen.nl/) might fit the bill.
EDIT: I may have misread your question, doxygen is a tool to generate documentation and models based off your code and javadoc.

Categories

Resources