I've just changed to eclipse an I'm used to manually managing my project structure with Windows filesystem (compiling my .java files into bin with a batch-script). Whenever I wanted my classes to use a .png-file, I simply put this file into the .bin folder.
If I put my .png-files in the bin-folder of the eclipse project as I'm used to, the classes will be able to load the pictures just fine. But sometimes, I don't know when, Eclipse simply deletes the bin-folder and creates a new one based on the contents of the src folder (which doesn't have my .png files). Putting the files into the src-folder (again, manually from the windows file-system) doesn't actually put them in my Eclipse project.
So what I want to ask is: Why/when does Eclipse completely rebuild the bin-folder. And how can I put resources, like .png-files, into my Eclipse project?
of course there is no point in putting files in the bin as it may be rebuilt by Eclipse whenever needed and you'll loose your changes.
by default Eclipse is set up to rebuild the project automatically, you can see that by looking in the "Project" menu entry, you can force Eclipse to rebuild your project by choosing "clean" in that "Project" menu.
So now you should have more control over when Eclipse is building your project.
Regarding adding resources files, I'm not sure what your current project directory structure is, in order to add / remove directories in the project, right click on the project root in the project Explorer side pane and choose "Properties" entry (at the bottom), then you can go to "Java Build Path" -> "Source" tab and manage the project directories.
last, if you change files on your disk and not through Eclipse, right click on the project root and choose "refresh" entry.
Hope this helps.
I was rearranging some files in eclipse, and I accidentally deleted the default output folder. This is the location where eclipse stores the class files. Can anyone show how to recover it? Or rebuild it from the .java files?
EDIT:
I just restored the project from backup files. So this question is no longer relevant. Unless some future reader did not backup their application before making this same mistake.
from the menu bar select:
Project->Clean...
That will bring up a dialog box to select which projects to rebuild. The bin directory should be automatically regenerated.
Recompile your project, and Eclipse should create it again (default name is bin on some versions)
If not, navigate to your project settings, and go to
Java Build Path > Sourceand at the bottom you will see the default output folder. You can create it again by using the Browse button, and then Create new folder
All you need to do is re-compile your project, For that you can select your Project and do Ctrl+B or just select Project->Build Project
EDIT:
As you mention in the comments that you still do not see the class files. Please check the Default output folder by selecting your project Right-click Build Path -> Configure build path... then select Source tab and see what the Default output folder: mentioned there, your class files must be created there.
Java Decompiler (JD) is generally recommended as a good, well, Java Decompiler. JD-Eclipse is the Eclipse plugin for JD.
I had problems on several different machines to get the plugin running. Whenever I tried to open a .class file, the standard "Source not found" editor would show, displaying lowlevel bytecode disassembly, not the Java source output you'd expect from a decompiler.
Installation docs in http://java.decompiler.free.fr/?q=jdeclipse are not bad but quite vague when it comes to troubleshooting.
Opening this question to collect additional information: What problems did you encounter before JD was running in Eclipse Helios? What was the solution?
Here's the stuff I ran into:
1) RTFM and install the "Microsoft Visual C++ 2008 SP1 Redistributable Package" mentioned
at top of the installation docs. I missed this at first because the Helios instructions are at the end.
2) Close all open editor tabs before opening a class file. Otherwise it's easy to get an outdated editor tab from a previous attempt.
3) Open the class file in the "Java Class File Editor" (not "Java Class File Viewer"). Use "Open With" in the context menu to get the right editor. If pleased with results, make it the default editor in the File Association settings, in Window/Preference General/Editors/File Associations select *.class to open with "Java Class File Editor".
4) This guy recommends installing the Equinox SDK from the Helios update site. I did, but I'm not sure if this was really necessary. Anyone know?
5) If the class files you are trying to view are in an Eclipse Java project, they need to be in the project's build path. Otherwise, an exception ("Not in the build path") will show up in the Eclipse error log, and decompile will fail. I added the class files as a library / class file folder to the build path.
6) Drag/dropping a class file from Windows Explorer or opening it with File/Open File... will not work. In my tests, I gives a "Could not open the editor: The Class File Viewer cannot handle the given input ('org.eclipse.ui.ide.FileStoreEditorInput')." error. That is probably the wrong editor anyways, see 3).
7) After getting the plugin basically running, some files would still not decompile for an unknown reason. This disappeared after closing all tabs, restarting Helios, and trying again.
To Make it work in Eclipse Juno - I had to do some additional steps.
In General -> Editors -> File Association
Select "*.class" and mark "Class File Editor" as default
Select "*.class without source" -> Add -> "Class File Editor" -> Make it as default
Restart eclipse
The JD-eclipse plugin 0.1.3 can only decompile .class files that are visible from the classpath/Build Path.
If your class resides in a .jar, you may simply add this jar to the Build Path as another library. From the Package Explorer browse your new library and open the class in the Class File Editor.
If you want to decompile any class on the file system, it has to reside in the appropriate folder hierachy, and the root folder has to be included in the build path. Here is an example:
Class is foo.bar.MyClass in .../someDir/foo/bar/MyClass.class
In your Eclipse project, add a folder with arbitrary name aClassDir, which links to .../someDir.
Add that linked folder to the Build Path of the project.
Use the Navigator View to navigate and open the .class file in the Class File Editor. (Note: Plain .class files on the file system are hidden in the Package Explorer view.)
Note: If someDir is a subfolder of your project, you might be able to skip step 2 (link folder) and add it directly to the Build Path. But that does not work, if it is the compiler output folder of the Eclipse project.
P.S. I wish I could just double click any .class file in any project subfolder without the need to have it in the classpath...
I am using Eclipse 3.7 Indigo and Windows 7 64-bit:
What I did was to install the Microsoft Visual C++ 2008 SP1 Redistributable Package as suggested by the site and reminded by #Universalspezialist.
Then install the plugin as stated in the site: http://java.decompiler.free.fr/?q=jdeclipse
Go to preference, then find "File Associations"
Click on the *.class, then set the "class File Editor" as default.
Restart Eclipse perhaps? (I did this, but I'm not sure if it's necessary or not)
Simple thing i did to get it working:
Went in eclipse > Window > Preferences
(Optional)typed in the search box "file" to help trim the tree of options.
Went to General > Editors > File associations.
Clicked the ".class" type. Below there were 2 editors present, i clicked on the "Class File Editor" - the one with the icon from JD, clicked the "Default" button on the right.
Done.
Now all ur class are belong to us.
After testing on Juno, Kepler and Luna, I found JD only works for *.class files on build path.
Adding the jar as a lib of an existing project
Go to Preferences->General->Editors->File Associations, set *.class without source to Class File Editor with a cup icon
Its should work for all version of eclipse even in Spring tool suit(STS).
Here is the steps
Go to the URl
Follow The link to download or click the bellow link to direct download
Click Here to download
Download JD-Eclipse.
Download and unzip the JD-Eclipse Update Site,
Launch Eclipse,
Click on "Help > Install New Software...",
Click on button "Add..." to add an new repository,
Enter "JD-Eclipse Update Site" and select the local site directory,
Select extracted folder and give any name. I have given JDA.
and click ok.
Check "Java Decompiler Eclipse Plug-in",
Next, next, next... and restart Eclipse.
I use jadeclipse instead, because it can't work in 3.6/3.7 eclipse
Update site
http://webobjects.mdimension.com/jadclipse/3.6/
Intallation
http://5thcross.wordpress.com/2009/05/20/installing-jadclipse-in-eclipse/
JAD Decomplier plug-in for Eclipse version 3.x and 4.x.
update site: http://feeling.sourceforge.net/update
Steps:
Open Eclipse IDE.
Click Help->Install New software
Paste above URL and give name as JAD.
Select the Eclipse Class Decompiler
Click on Next and accept agreements
Install it.
Restart Eclipse and check now.
if you need to decompile standalone jar try JD-GUI by the same autor (of JD-Eclipse). It is a standalone application (does not need eclipse). It can open both *.class and *.jar files. Interesting enough it needs .Net installed (as do JD-Eclipse indeed), but otherwise works like a charm.
Find it here:
http://jd.benow.ca/
Regards,
I made the steps 1, 2, 3 and the 7. and I put the folder with the class files in the project build path (right click, properties, java build path, libraries, add class folder, create new folder, advanced>>, link to folder in the file system, browse,...) then restart eclipse.
Download the JD-Eclipse Update Site(github.com/java-decompiler/jd-eclipse)
Launch Eclipse,
Click on "Help > Install New Software...",
Click on button "Add..." to add an new repository,
Enter "JD-Eclipse Update Site" and select the local site directory,
Check "Java Decompiler Eclipse Plug-in",
Next, next, next... and restart Eclipse.
Just download the site from the JD page. I was able to install from a local site in the isntalled software section of eclipse.
Steps to add the Java Decompiler in Eclipse :
Open Eclipse IDE.
Click Help->Eclipse Marketplace Wizard
In Search tab find the JD (JD is keyword to get the Eclipse Class Decompiler)
Select the Eclipse Class Decompiler
Click on Install.
Restart Eclipse and check
I used Intellij or Android studio both are working awesome for decompiling purpose.
Internally Intellij following FernFlower Decompiler.
After I clean a project in eclipse I don't see the class files generated in the output folder "bin" although there's no build error, what can I do to make it regenerate the class files?
thanks
It might be that your project is configured to write classes to somewhere other than ./bin
Under the "Project" menu, see if the option "Build Automatically" is checked.
Edit: Have you checked this on Eclipse or on a file browser? Sometimes Eclipse takes a long time to refresh changes in the file system. Force a refresh by right clicking the bin folder and clicking on "Refresh" on the contextual menu.
Edit: Check your build path, try reconfiguring it from scratch, I don't know if this can help, but who knows...
To generate these .class files manually, which are lost after cleaning the project, uncheck build automically which is under Project and then right click on your project and select build project which will regenerate your lost .class files
I am using Eclipse 3.4.1 Build M20080911-1700
I have tried to change the classpath directories for jar and the source directory using the Project Properties -> Java Build Path -> Libraries Tab or Source Tab. When I click OK button and then return to the properties page, my changes were not applied.
I have to resort in the work around by manually changing the eclipse ".classpath" project settings file.
Any ideas?
Is the .classpath file checked into source control? You may not be able to change it if you don't have it checked out.