Eclipse Luna takes a long time saving an xml file :( - java

About a month ago I went from Windows to a MacBook Pro.
Same Eclipse version, (almost) same settings, but it frustrates me that saving an xml file takes about 10s :(... Even if I just delete/add a space char.
I have a lot of files, about 10 projects opens in Eclipse but my old Windows box with an old quad core (not even an i7) had no problems with this.
I know this is a knows problem in Eclipse and I had it in the past as well, but it was solved after a few upgrades in the past.
Currently I run on the latests Luna version, with up2date plugins, tried a lot of possible solution, most from SO, but still not solved. Please some help.
I am using EE Eclipse to mainly develop java web apps and use the following plugins: AspectJ (with Xref), EGit, JGit, CheckStyle, Maven, TestNG.
All files are stored as UTF-8
Editing the xml file is slow in both the text and the xml editor.
It concerns xml files that are located in a java package (in the /src/main/java/ folder).
The strange thing is that Editing an xml file in a project-root subfolder isn't slow, like: project-root/test-output/bla.xml (works well in both the text and xml editor)... weird...
Both files (the slow and fast save one) are part of version control and used by Git.
In case I copy the slow file to the folder project-root/test-output/, it's also saved fast :(
Renaming the slow file such that it has the "txt" extension and editing with the text editor has not effect.
I thought it is caused by some builder that works only on the java source folder...
The project has a Java and Maven builder. Disabling them has no effect.
The Eclipse log file doesn't contain any relevant exception. It contains some key-binding exceptions and resource tree locked modifications, but these exceptions are old.
What I tried (what I can remember):
+ Disabled all validation (especially the xml validation), for all projects.
+ Ensure all latest updates are installed of all plugins, including the EGit plugin.
+ Disabled Checkstyle.
+ ...
Any ideas as I am getting a bit frustrated about this?

A poor-man's solution may be in
switch to a empty workspace (workspace2 in example)
create a new pde-plugin-project (mytestplugin in example)
debug the mytestplugin means you debug a instance of eclipse too, so use the workspace you usually work with in the debugging-second-eclipse.
Now: save the xml-file in the debugging-second-eclipse with the workspace you usually work with, quick jump to the first eclipse and press "pause" to stop the second-eclipse.
inspect the compleate debug-stacktrace-thread-tree in the debug view (please post the image as a comment here).
Regards

When Trying the solution of #Peter I noticed that the workspace I was using was located in the "eclipse.app" file like this:
/Applications/eclipse/Eclipse.app/Contents/MacOS/D:\Users\Ed\Develop\Projecten\EclipseWorkSpace/
No idea why/how this happened. However, I moved this workspace to a "normal" directory in my home folder, and how saving an xml file work normal, fast as expected...
No idea why having the workspace located in the eclipse.app made it slow, but it works ...

Open eclipse.ini.
Increase -Xms, -Xmx
This works for me.

Related

Java File Corrupted

Yesterday, i've Closed Eclipse & then Turned Off The Computer, Now it's appear that a Crash has occured, when i started Eclipse again, Project List was empty So i've imported the Projects Again,
Problem : a Java Files is now corrupted, the file size seem correct, i can Open the File but the File is filed with "NUL" when i open it with a Text Editor & is empty when i open it in Eclipse,
I've tried to use the History Features of eclipse but there is No Any Backup in the .History Folder, only empty folders,
Is there any way to recover this Damaged .Java File ?
Thanks
if you use SVN, or other version controls, or ever back up your PC, you could look at restoring it from there. However, by your description, this doesnt seem likely.
Noting from your comments you have tried a system restore.. System restore points and backing up your PC are two different things.
Right click on your file -> Properties.
The click "Previous Versions" along the top.
It may say "There are no previous versions available", or may offer a restore choice.
Perhaps if you had previously deployed the project you can get at the class file and de-compile the class back to code but that may still result in some loss. Also just try doing a search on your machine for that file name perhaps it was backed up by you at an earlier time that you forgot about.

Eclipse SVN always includes auto generated bin dir and classes no matter what I do

I am using Eclipse Juno with Subversive plugin.
I have a java project set to compile automatically which creates a lot of bin dirs
No matter what pattern i put in window-> preferences->->team->ignored resources, eventually i see the bin dir and all of it's sub dirs in the team synchronizing perspective as new uncommitted files.
I have tried the following syntax:
*/bin,**/bin, */bin/, */bin/*
No luck.
Also, I have noticed that sometimes if I close eclipse and start it again, the ignored files disappear from the team synchronizing perspective as required, but still, some bin dirs are still present. This whole thing is very inconsistent.
Any idea ?
I have forgot to mention that I am using two worksets, one is the subset of the other, this add buggyness to the whole process appearently
Try the "Subversive SVN JDT Ingnore Extensions". It is located on the Juno Update Site, under "Collaboration". Its description says:
The feature is useful for Java development because it allows to automatically interpret output folders as ignored resources.
Seems like exactly what you want. Also, it should work independently of the name of your output folders which is an advantage if you use Maven for example (in that case, your output folders will probably be called target and not bin).
I gave up and switched to Subclipse. Now everything seems to be working fine, or at least less buggy.

How to debug Java code when it is out of sync?

One of the problems I'm running into is that my jar files and my source files don't match.
I'd like to:
Be Notified when when source and binary don't match (I think Visual Studio can do something like this...)
Set break points not by line, but by function. For example, set a break point at the entry of function foo().
I use eclipse mainly; so Solutions for eclipse would be most appreciated, but any IDE (or command line debugger) will do.
Thanks!
When developing just use and link to .class files that are saved by your IDE.
If your project starts to grow to a point where it's really useful to link to a .jar you're better off treating the jar's as separate projects.
Go to Project tab in Eclipse and then
click clean: Project->Clean…
click build automatically: Project->Build automatically
Use method breakpoints instead of line breakpoints. They can be set to halt on entering/exiting a method. You get them by double clicking the left editor side in a line containing a method declaration.
The debug information is limited to line numbers in the source file... I do agree that having a warning that the lines are wrong would be nice, but that would require more meta data in the jar than I think is available...
You might want to consider addressing the challenge with a change in your build process. This isn't exactly answering your question, but hopefully it will give you a strategy that will address the underlying problem.
When you generate the jar for deployment, also generate a jar with the binary AND source. For investigating the source code of a stack trace on the live server, set up a separate project in eclipse and have the binary+source jar be on the classpath. You may have to explicitly set the source code location back to the same jar (though I think Eclipse will just do this automatically).
Then you just have to add copying of the binary+source jar into the appropriate location in your workspace as you do your deployments (preferably with a deployment script).
If it's your server, you may want to even consider deploying the binary+source jar to the live server - that way you will always be able to get at the source.

Eclipse and its faux file management

I have a fairly large Eclipse project that has undergone several major refactorings over the past 6 months. Packages have been added, deleted, renamed (using Refactor >> Rename), and the same for source files within those packages.
Today I wanted to get a count of how many source files I had under the project root and was startled by what AgentRansack returned. I was expecting something on the order of 200 - 250, but it turned back ~325. I started looking at the list of files, and, sure enough, some of them were Java files I deleted eons ago.
I opened up Windows Explorer and took a gander at my project directory, and of course, saw them all just sitting there on my file system, like nothing ever happened to them.
Obviously, Eclipse is rendering a "view" (of some sort) of my project directory, and is using some kind of metadata to mark "deleted" ones, renamed ones, etc. But to the file system, nothing is changing.
Ordinarily I wouldn't be upset about this, but I just went to import a class that used to be pacakged as org.me.myproj.fizz.Widget, but was later refactored to be packaged as org.me.myproj.buzz.Widget. When I hit the shortcut (Ctrl+Shift+O), Eclipse asked me which Widget I wanted - but the first one shouldn't even exist anymore!!!
When I'm deleting packages/folders/files in Eclipse, or if I'm renaming/moving them via Refactor >> Rename/Move, how do I make sure the changes are permanent to the underlying file system??

Eclipse run old version of program

I have a problem while runing my application in eclipse. I make some edits like this:
String res = "newvalue";
System.out.println(res);
But when I run the application I still receive "oldvalue" in output. After this I tried to delete main() function - and I run application and I see "oldvalue" in output again.
Maybe it's some cache in JVM, or smth. else?
UPD:
It's 15:35 on my clock now. But in /bin folder I see .class files with 14:33 timestamp. I change source files (.java), press ctrl+f11 in eclipse and files in /bin folder are still 14:33 ...
UPD2:
After cleaning the project I receive the following problem:
The project was not built due to "Could not write file: D:\projects\NelderMead\bin\ru.". Fix the problem, then try refreshing this project and building it since it may be inconsistent
SOLUTION
The problem was that eclipse can't write file to the folder with spaces and UTF chars in it's name. So, I copy project to the new clean workspace and it runs without problems! Thx all for help detecting the problem!
You're executing an older class files, the reason could be
a compile error somewhere else (see problems view)
or your changed accidentally the source path so that the new source no longer gets compiled.
Try to clean the project and make sure the new classes are compiled to your output folder.
The JVM doesn't have a cache for class files.
First, make sure the file is saved (there is no asterisk next to the file name in the tab). Usually files are saved automatically, but you could choose not to save files and never ask by mistake, the first time Eclipse pops up this dialog.
Then see what's going on in the Problems view. You might see something like project cannot be built due to the following reason. It may be because of compilation errors in the dependent projects.

Categories