Friday 21 June 2013

Setting up Eclipse check list (Part 1)

I find my self due to a major laptop Snafu setting up eclipse from scratch (again) so I thought I would document the stages.

Download Eclipse IDE

You need the IDE for java developers and the latest version can be found here: http://www.eclipse.org/downloads/.
Once it is downloaded upzip it to a target folder.
For this install it will be "C:\development\java\eclipse\indigo". What ever you do don't include any spaces in the path as certain java tools don't like it.
I have also named it with the version so I can install others later.
Set your self up a windows short cut to avoid hunting for it later.

Edit the Eclipse.ini to optimise settings

While eclipse should run straight out of the box (unless you download the 32bit one and are running on a 64 bit system).
Before modifying the eclipse.ini file please back it up. The ini file can be error prone with returns and spaces.

I have an other post which will detail some of the settings you need but they boil down to these:

-vmargs
-Xverify:none
This will tell the VM not to validated all the .class files it is loading.
-vm
<Path to JDK>/jre/bin/server/jvm.dll
Aledgedly Eclipse runs better when linked to a specific dll.
A desirable side effect of this is that if there are any problems with Ports the fire wall will now report "Eclipse" is requesting to access ... sooner than "Java".
Please note the new line after the -vm param.
-vmargs
-Xms128m
-Xmx2048m
Give your self some more memory space. Particularly if you have plenty of memory on your PC.
-vmargs
-Dosgi.requiredJavaVersion = 1.6
Tell Eclipse that it can use the latest version of Java.
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XX:+AggressiveHeap
-XX:+AggressiveOpts
-XX:+UseParallelOldGC
-XX:ParallelGCThreads=2
-XX:ThreadPriorityPolicy=1
This is an alternate option to setting up the size of memory by hand and these options do not work with -Xms and -Xmx.
They work as follows:
  • The -XX:+AggressiveHeap option inspects the machine resources (size of memory and number of processors) and attempts to set various parameters to be optimal for long-running, memory allocation-intensive jobs. It was originally intended for machines with large amounts of memory and a large number of CPUs, but in the J2SE platform, version 1.4.1 and later it has shown itself to be useful even on four processor machines.
  • A feature available with the throughput collector in the J2SE platform, version 1.4.1 and later releases is the use of adaptive sizing (-XX:+UseAdaptiveSizePolicy), which is on by default. Adaptive sizing keeps statistics about garbage collection times, allocation rates, and the free space in the heap after a collection. These statistics are used to make decisions regarding changes to the sizes of the young generation and tenured generation so as to best fit the behavior of the application. Use the command line option -verbose:gc to see the resulting sizes of the heap.
  • UseParallelOldGC
    Use the Parallel Old garbage collector, This flag enables a parallel version of both the young- and old-generation collectors.
    "UseParallelGC" Use the Parallel Scavenge garbage collector which only enables a parallel collector for the young generation and keeps a serial collector for the old generation.  A serial collector is a single-threaded collector, while the parallel collector that we are enabling can use multiple threads to collect garbage.
    -XX:+UseParallelOldGC is preferred for newer Java releases.
  • -XX:+AggressiveOpts Turns on point performance optimizations.
    Note: this option is experimental! The specific optimizations enabled by this option can change from release to release and even build to build. You should reevaluate the effects of this option with prior to deploying a new release of Java.
  • -XX:ParallelGCThreads=2 Number of parallel threads parallel gc will use. If too more ParallelGCThreads are specified than CPU cores where the JVM is running, this can cause bottlenecks.
    I have 4 cores (:P) so I'm going to use two to prevent it grabbing every thing.
  • -XX:ThreadPriorityPolicy=1
    As 0 = Normal and 1 = Aggressive.
    On Linux thread priorities are ignored because the OS does not support static priority but on windows it works.
    This policy should be used with care, as sometimes it can cause performance degradation in the application and/or the entire system. However, with ThreadPriorityPolicy=0, VM will not use the highest possible" native priority,


Eclipse Preferences
  • Windows -> Preferences; General --> [x] Show heap status.The best way to monitor the current memory useage in Eclipse is to enable HEAP monitoring:

  • Windows -> Preferences; General -> Appearance -> Label Decorations
    disabling label decorations you don't need;
  • Windows -> Preferences; General -> Startup and ShutdownGet rid of "Usage data gathering", "Equinox ...", "Mylyn..>", "Market Place client".
  • Windows -> Preferences;  MavenTurn off all un needed options on the first Maven tab (all?)
  • Windows -> Preferences;Mylyn --> TasksTurn of sysncronization;

At this point Eclipse should run like lightning.
The next thing to do is to start adding in your plugins.
This is the topic of the next post.

So for reference my eclipse.ini looks like this:

-vm
C:/development/tools/Java/jdk1.7.0_17/jre/bin/server/jvm.dll
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502
-product
org.eclipse.epp.package.java.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XX:+AggressiveHeap
-XX:+AggressiveOpts
-XX:+UseParallelOldGC
-XX:ParallelGCThreads=2
-XX:ThreadPriorityPolicy=1
-Xverify:none




See: http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html



(Next>>)

No comments:

Post a Comment