How to work out why Eclipse is slow to start JVM? - java

In the last week or two, when I run Java code inside Eclipse Juno, it takes 2-3 seconds before it starts executing. I know it doesn't sound like long, but it adds up to being really annoying. (The same thing happens when I run JUnit tests).
It didn't use to take this long. It used to be almost instantaneous. I can't figure out what has changed in my system configuration and how to change it back.
In terms of the environment, the only thing that I can think of is that I recently installed a Java plugin into Chrome, but I can't see how that would affect Eclipse, as it's using a different JDK (and not the JRE I installed).
What should my next step be? How can I narrow-down what's causing it?

I bet this is because of having so many projects that are open in the workspace! You can close any non-used project by right-clicking on it and then select Close Project.

Related

Intellij Idea Community Constantly Freezes and Maven projects stuck on reading pom.xml for a very long time

I have just installed Intellij Idea Community on my work computer (virtual machine) and it constantly freezes for more than a minute at times every few minutes. Additionally, when I can finally do some work and load, and when I open a maven project, the reading pom.xml stage can take 20-30 minutes. This also happens anytime I make changes to my pom.xml file.
I read a bit about the vm options but couldn't understand enough of it to make any changes.
Google Drive Link to idea logs
Check your intellij memory settings. Increase it if it is low.
Go to Help -> click on Change Memory Settings
In Popup increase the memory.
Click Save and Restart
I fixed the maven problem by setting a proxy in intellij. This did not occur to me at first as none of the other IDEs that we use have proxies set.
As for the constant freezing, a majority of it was caused due to the maven scans and since I dont have that problem anymore, I don't need to worry too much about the freezes either

Eclipse says I have errors every day, but I don't

This seems to be a problem with the on-the-fly code parser. As I am typing something, eclipse (latest release version) might update to reflect that I have an error. But when I finish typing the line, the error will still remain in the Problems tab and never get fixed, no matter what changes I make to that file or any other file. The only way to fix this problem is to go to Project->Clean... which of course works every time.
I use a rapid prototyping technique where I need to test my project hundreds of times throughout a day. This error happens about 10% of the time I want to run or debug a project, which is 10 times every day. Cleaning my project takes a significant number of seconds since we have hundreds of resources that need to be re-parsed. This is very frustrating and is killing my productivity. Is there any fix or patch to eclipse to fix this problem? If not, does anyone know of a workaround?
Right click your project and hit refresh. It usually works and is much faster than a full clean and build.
can you please expand the errors ?
I guess this must be due to linking error..
ensure all the required jar are added, that should resolve.

Why does Tomcat 'Out of Memory' right when I attempt to start server in Eclipse?

As soon I click to start (literally immediately) the tomcat server with my web app, it displays the following error:
http://i67.photobucket.com/albums/h282/jamesekki/error.jpg
What's weird is the application still builds successfully and works fine. The problem is it slows down development time since I get this error every time I need to deploy any changes.
Here is my eclipse ini:
http://i67.photobucket.com/albums/h282/jamesekki/Capture.jpg
Any ideas?
Things I have tried:
1. Increased xms/xmx in increments of 128 megs all the way up to 4 gigs (still fail)
2. Increased permsize/maxpermsize similar to increments above (still fail)
Maybe these will help explain:
http://www.mulesoft.com/tomcat-oome-out-of-memory-error
http://baskarfelix.wordpress.com/2008/08/06/out-of-memory-errorjava-heap-space/
I'd also be curious to know if you have the same issue if you leave Eclipse out of the picture. Create a WAR file, add it to the Tomcat /webapps directory, and start Tomcat using a command shell and the start script in the /bin directory. If you still have a problem, I'd say you should look at how Tomcat and your JVM are configured. If you don't, it tells me that Eclipse is the problem.
Thanks everyone for your inputs. I was able to narrow it down to what was the root cause of the whole issue. I had an external api jar file in the src/main/resources/lib of my services layer and Eclipse seems to not like that for whatever reason. As soon as I moved that out of that location, it resolved the issue. Can anyone explain why this would potentially cause an issue? Just for learning purposes. Thanks!
Your settings look good to me. You could try the long way of profiling [1] tomcat to see what happens on startup, or the crude way of deleting your local server and runtime, to see if it helps with a fresh one. If that fails, re-download latest Eclipse Java EE edition, and set up from scratch.
While it's not the best solution (in case the problem resurfaces, you still have no proper solution), it is sometimes worth it if it takes too long otherwise.
[1] You could profile with JProfiler or YourKit Profiler. Both have trial versions. JVisualVM is also an alternative that comes with the JDK. However it may be an issue if Tomcat crashes immediately.

IntelliJ IDEA freezing on source code completion

I'm using IntelliJ IDEA 10.0 for Java development. A few days ago it started to reveal a strange behavior with auto-completion: pop-ups with completion options appears as usual,
but IDEA completely freezes after choosing an option.
Cache cleaning doesn't help.
Has anyone else encountered this?
Update: Another symptom: IDEA freezes when trying to auto-implement method (e.g. toString)
This is may be due to garbage collector working hard.
Try give your IDE more memory. You can do it in idea.exe.vmoptions(if you use windows). Increase -xmx property to at least 512 MB.
This may not be the same issue you describe, but I have experienced long (but not eternal) freezes, where after a minute or two it came back to respond. This happened whenever I pressed Ctrl+Alt+Space in the code completion popup, which caused IDEA to load all project and external libraries to browse for possible completion options.

Eclipse 3.6 frequently stalls during Content Assist

The auto complete stalls so frequently and for so long, I quit using it altogether.
I've had success with the following using Eclipse (Classic) 3.6.1 on Windows 7 x64.
"A workaround, until the fix is released in 3.6.2 is summarized here: http://groups.google.com/group/android-developers/msg/0f9d2a852e661cba"
(copied for convenience)
"You can replace your /plugins/
org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar plugin with one from
http://www.google.com/url?q=http://adt-addons.googlecode.com/svn/patches/org.eclipse.jdt.core_3.6.1.v_A68_R36x.zip&ei=vg5aTf2RIMrUgAeI-qTvDA&sa=X&oi=unauthorizedredirect&ct=targetlink&ust=1297749446528273&usg=AFQjCNFv7FGlTrnoVhRGE35JPjHxOwI_Bw
and restart Eclipse. Content Assists will be much better. Just try it.
Don't forget backup your original plugins. "
This solved part of my problem.
In preferences, I defaulted all the 'Java->Editor->Content assist' screens and the performance is much improved. Any lag I have now is due to system speed and is negligible. I've gone from minutes to seconds building the suggestion list.
UPDATE: This didn't completely solve my problem, but it got me close. The search continues...
UPDATE: I'm developing in Java for Android using the default packages that are included and any that might have come down during a update(in retrospect, maybe choosing update all in the SDk update might not have been wise). The timing is fairly consistent online and offline. I did a few tests and found the following:
Startup Eclipse and enter a line of code that can use a .toString(). Typing the '.' populates the auto complete within 2-3 seconds. Type a 't' and it takes 70-75 seconds. After that, 10 seconds. Diff objects do the same thing(75 the first time, 10 after that). It's the filtering process that appears to stall. My CPU does not max, Memory is OK, but the program will go not responding till it's done. Any typeahead gets cached and eventually filters the list when Eclipse starts responding.
For me the problem went away when I increased the memory for the vm.
Put this in your eclipse.ini:
-Xms512m
-Xmx1024m
on my 4GB Windows Vista system this would happen A LOT !! (as well as debug issues when looking up variables).
This all went away after I built my new PC with 8GB RAM. I can now run 4 emulators simultaneously and it doesn't have any debug problems any more either. Auto complete with huge lists also works just fine.
it would seem to be just an issue with how much RAM you've got.

Categories

Resources