Top eclipse Questions

List of Tags

I am using Eclipse Android plugins to build a project, but I am getting this error in the console window:

[2010-02-03 10:31:14 - androidVNC]Error generating final archive:

Debug certificate expired on 1/30/10 2:35 PM!

How do I fix it?

Answered By: Christopher ( 1615)

Delete your debug certificate under ~/.android/debug.keystore on Linux and Mac OS X; the directory is something like %USERPROFILE%/.androidon Windows.

The Eclipse plugin should then generate a new certificate when you next try to build a debug package. You may need to clean and then build to generate the certificate.

Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error 'The method ?????????? must override a superclass method'.

It may be noteworthy to mention this is with Android projects - for whatever reason, the method argument values are not always populated, so I have to manually populate them myself. For instance:

list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

    //These arguments have their correct names
    public void onCreateContextMenu(ContextMenu menu, View v, 
                                    ContextMenuInfo menuInfo) {                 


will be initially populated like this:

list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

    //This methods arguments were not automatically provided    
    public void onCreateContextMenu(ContextMenu arg1, View arg2,
                                    ContextMenuInfo arg3) {


The odd thing is, if I remove my code, and have Eclipse automatically recreate the method, it uses the same argument names I already had, so I don't really know where the problem is, other then it auto-formatting the method for me.

This becomes quite a pain having to manually recreate ALL my overridden methods by hand. If anyone can explain why this happens or how to fix it .. I would be very happy.

Maybe it is due to the way I am formatting the methods, which are inside an argument of another method?

Answered By: alphazero ( 745)

Eclipse is defaulting to Java 1.5, when you want it to use Java 1.6.

You have classes implementing interface methods, which in Java 1.6 can be annotated with @Override; however, in Java 1.5, @override could only be applied to methods overriding a superclass method.

Go to your project/ide preferences and set the "Java compiler level" to 1.6 and also make sure you select JRE 1.6 to execute your program from Eclipse.

Eclipse issues warnings when a serialVersionUID is missing.

The serializable class Foo does not declare a static final serialVersionUID field of type long

What is serialVersionUID and why is it important? Please show an example where missing serialVersionUID will cause a problem.

Answered By: Jon Skeet ( 293)

The docs for are probably about as good an explanation as you'll get:

The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender's class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named "serialVersionUID" that must be static, final, and of type long:

ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;

If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value. It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class--serialVersionUID fields are not useful as inherited members.

Which tricks do you know to make the experience with Eclipse faster?

For instance: I disable the all the plugins I don't need (Mylyn, Subclipse, …).

Instead of using a plugin for Mercurial I configure TortoiseHG as an external tool.

Answered By: VonC ( 138)

I agree with the previous answers:

The three most influential factors for Eclipse speed are:

  • using the latest Eclipse (3.7.1)

  • launching it with the latest JDK (1.7, which does not prevent you to compile in your Eclipse project with any other JDK you want: 1.4.2, 1.5, 1.6 older...)

    -vm jdk1.6.0_10\jre\bin\client\jvm.dll

  • configuring the eclipse.ini (see this question for a complete eclipse.ini)

    -Xms128m -Xmx384m -XX:MaxPermSize=128m -Xss2m [...]


  1. referring to the jvm.dll has advantages:

    • Splash screen coming up sooner.
    • Eclipse.exe in the process list instead of java.exe.
    • Firewalls: Eclipse wants access to the Internet instead of java.
    • Window management branding issues, especially on Windows and Mac.

    But it can also have some drawbacks if you try to push the memory too high.

  2. The default memory taken by Eclipse is the combination of MaxPermSize and Xmx. Here up to 512 MB total, which is quite enough for a 1 GB memory computer.


SVN in Eclipse is spread into 2 camps. The SVN people have developed a plugin called Subclipse. The Eclipse people have a plugin called Subversive. Broadly speaking they both do the same things. What are the advantages and disadvantages of each?

Answered By: Brendon ( 94)

Both are very similar but Subversive is the "eclipse svn provider". I primarily use subversive because of a few convenient features.

Grouping of history. When i'm browsing the history of a branch instead of just seeing a bunch of rows for every commit it can group commits by today, week, etc.

Mapping of trunk, branches, and tags. Subversive assumes the default svn layout trunk, branches, tags (which you can change) so whenever you want to tag or branch its one click and you provide the name of the tag or branch.

Like i said these are minor differences that i just find convenient. Both work great with mylyn, but overall there really isn't a whole lot of differences with theses two extensions.

Merging with subversive is a pain though (haven't tried subclipse), I've never been able to successfully merge. The preview of the merge is great but it would never complete the merge or it will take way to long. Most of the time i complete merging thru the command line without any issues.

Craig Angus

What are the best JVM settings you have found for running Eclipse?

Answered By: VonC ( 317)

It is that time of year again: "eclipse.ini take 3" the settings strike back!

Eclipse Helios 3.6 and 3.6.x settings

alt text

After settings for Eclipse Ganymede 3.4.x and Eclipse Galileo 3.5.x, here is an in-depth look at an "optimized" eclipse.ini settings file for Eclipse Helios 3.6.x:

(by "optimized", I mean able to run a full-fledge Eclipse on our crappy workstation at work, some old P4 from 2002 with 2Go RAM and XPSp3. But I have also tested those same settings on Windows7)


alt text

WARNING: for non-windows platform, use the Sun proprietary option -XX:MaxPermSize instead of the Eclipse proprietary option --launcher.XXMaxPermSize.
That is: Unless you are using the latest jdk6u21 build 7. See the Oracle section below.


Adapt the to an external directory of your choice.
See this SO answer. The idea is to be able to drop new plugins in a directory independently from any Eclipse installation.

The following sections detail what are in this eclipse.ini file.

The dreaded Oracle JVM 1.6u21 (pre build 7) and Eclipse crashes

Andrew Niefer did alert me to this situation, and wrote a blog post, about a non-standard vm argument (-XX:MaxPermSize) and can cause vms from other vendors to not start at all.
But the eclipse version of that option (--launcher.XXMaxPermSize) is not working with the new JDK (6u21, unless you are using the 6u21 build 7, see below).

The final solution is on the Eclipse Wiki, and for Helios on Windows with 6u21 pre build 7 only:


That's it. No setting to tweak here (again, only for Helios on Windows with a 6u21 pre build 7).
For non-Windows platform, you need to revert to the Sun proprietary option -XX:MaxPermSize.

The issue is based one a regression: JVM identification fails due to Oracle rebranding in java.exe, and triggered bug 319514 on Eclipse.
Andrew took care of Bug 320005 - [launcher] --launcher.XXMaxPermSize: isSunVM should return true for Oracle, but that will be only for Helios 3.6.1.
Francis Upton, another Eclipse committer, reflects on the all situation.

Update u21b7, July, 27th:
Oracle have regressed the change for the next Java 6 release and won't implement it again until JDK 7.
If you use jdk6u21 build 7, you can revert to the --launcher.XXMaxPermSize (eclipse option) instead of -XX:MaxPermSize (the non-standard option).
The auto-detection happening in the C launcher shim eclipse.exe will still look for the "Sun Microsystems" string, but with 6u21b7, it will now work - again.

For now, I still keep the -XX:MaxPermSize version (because I have no idea when everybody will launch eclipse the right JDK).

Implicit `-startup` and `--launcher.library`

Contrary to the previous settings, the exact path for those modules is not set anymore, which is convenient since it can vary between different Eclipse 3.6.x releases:

  • startup: If not specified, the executable will look in the plugins directory for the org.eclipse.equinox.launcher bundle with the highest version.
  • launcher.library: If not specified, the executable looks in the plugins directory for the appropriate org.eclipse.equinox.launcher.[platform] fragment with the highest version and uses the shared library named eclipse_* inside.

Use JDK6

The JDK6 is now explicitly required to launch Eclipse:

-Dosgi.requiredJavaVersion = 1.6

This SO question reports a positive incidence for development on Mac OS.


The following options are part of some of the experimental options of the Sun JVM.


They have been reported in this blog post to potentially speed up Eclipse.
See all the JVM options here and also in the official Java Hotspot options page.
Note: the detailed list of those options reports that UseFastAccessorMethods might be active by default.

See also "Update your JVM":

As a reminder, G1 is the new garbage collector in preparation for the JDK 7, but already used in the version 6 release from u17.

Opening files in Eclipse from the command line

See the blog post from Andrew Niefer reporting this new option:


This tells the launcher that if it is called with a command line that only contains arguments that don't start with "-", then those arguments should be treated as if they followed "--launcher.openFile".

eclipse myFile.txt

This is the kind of command line the launcher will receive on windows when you double click a file that is associated with eclipse, or you select files and choose "Open With" or "Send To" Eclipse.

Relative paths will be resolved first against the current working directory, and second against the eclipse program directory.

See bug 301033 for reference. Originally bug 4922 (October 2001, fixed 9 years later).

p2 and the Unsigned Dialog Prompt

If you are tired of this dialog box during the installation of your many plugins:

alt text

, add in your eclipse.ini:


See this blog post from Chris Aniszczy, and the bug report 235526.

I do want to say that security research supports the fact that less prompts are better.
People ignore things that pop up in the flow of something they want to get done.

For 3.6, we should not pop up warnings in the middle of the flow - no matter how much we simplify, people will just ignore them.
Instead, we should collect all the problems, do not install those bundles with problems, and instead bring the user back to a point in the workflow where they can fixup - add trust, configure security policy more loosely, etc. This is called 'safe staging'.

---------- alt text alt text

Additional options

Those options are not directly in the eclipse.ini above, but can come in handy if needed.

The `user.home` issue on Windows7

When eclipse starts, it will read its keystore file (where passwords are kept), a file located in user.home.
If for some reason that user.home doesn't resolve itself properly to a full-fledge path, Eclipse won't start.
Initially raised in this SO question, if you experience this, you need to redefine the keystore file to an explicit path (no more user.home to resolve at the start)

Add in your eclipse.ini:


This has been tracked by bug 300577, it has been solve in this other SO question.

Debug mode

Wait, there's more than one setting file in Eclipse.
if you add to your eclipse.ini the option:


, you enable the debug mode and Eclipse will look for another setting file: a .options file where you can specify some OSGI options.
And that is great when you are adding new plugins through the dropins folder.
Add in your .options file the following settings, as described in this blog post "Dropins diagnosis":


P2 will inform you what bundles were found in dropins/ folder, what request was generated, and what is the plan of installation. Maybe it is not detailed explanation of what actually happened, and what went wrong, but it should give you strong information about where to start:

  • was your bundle in the plan?
  • Was it installation problem (P2 fault)
  • or maybe it is just not optimal to include your feature?

That comes from Bug 264924 - [reconciler] No diagnosis of dropins problems, which finally solves the following issue like:

Unzip to ..../eclipse
Unzip to ..../eclipse/dropins/mdt-ocl-SDK-1.3.0M5

This is a problematic configuration since OCL depends on EMF which is missing.
3.5M5 provides no diagnosis of this problem.

Start eclipse.
No obvious problems. Nothing in Error Log.

  • Help / About / Plugin details shows org.eclipse.ocl.doc, but not org.eclipse.ocl.
  • Help / About / Configuration details has no (diagnostic) mention of org.eclipse.ocl.
  • Help / Installation / Information Installed Software has no mention of org.eclipse.ocl.

Where are the nice error markers?

Manifest Classpath

See this blog post:

  • In Galileo (aka Eclipse 3.5), JDT started resolving manifest classpath in libraries added to project’s build path. This worked whether the library was added to project’s build path directly or via a classpath container, such as the user library facility provided by JDT or one implemented by a third party.
  • In Helios, this behavior was changed to exclude classpath containers from manifest classpath resolution.

That means some of your projects might no longer compile in Helios.
If you want to revert to Galileo behavior, add:


See bug 305037, bug 313965 and bug 313890 for references.

IPV4 stack

This SO question mentions a potential fix when not accessing to plugin update sites:

Mentioned here just in case it could help in your configuration.

JVM1.7x64 potential optimizations

This article reports:

For the record, the very fastest options I have found so far for my bench test with the 1.7 x64 JVM n Windows are:


But I am still working on it...


I just downloaded and installed the new Android SDK. I wanted to create a simple application to test drive it.

The wizard created this code:

package eu.mauriziopz.gps;

import android.os.Bundle;

public class ggps extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

but Eclipse gives me the error

R cannot be resolved

on line



PS: I do have an XML file named main.xml under res/layout/.

Answered By: Michael Levy ( 518)

After tracking down this problem as well, I found this note in the Android documentation:

*Note: Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask Eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.*

While going through the Android sample tutorials, I would often use the Ctrl + Shift + O command to "Organize Imports" and generate any missing import statements. Sometimes this would generate the incorrect import statement which would hide the class that is automatically generated when you build.

Bartosz Radaczyński

Is Eclipse at all themeable? I would like to install a dark color scheme for it, since I much prefer white text on dark background than the other way around.

Edit: so apparently there is NO easy way to do it. Shame, I really prefer Eclipse to NetBeans, but I cannot stand the white background (and NetBeans does support themes).

Edit 2: there is a plugin that allows this right not as some of the people mentioned. Thanks for the information, everyone.

Answered By: fhd ( 184)

As posted to a few related questions already, I'm working on a plugin for easy, cross-editor color theme management:

It is still work in progress, but already supports many editors and a few dark color themes.


I was amazed to find out that apparently Eclipse doesn't come with a decent HTML editor by default (it opened my .html file in some kind of browser view and apparently tried to render it). And the basic text editor is not good enough (I need at least some syntax highlighting and automatic indenting).

Any suggestions?

Answered By: Leo Lännenmäki ( 164)

If you installed the basic Eclipse package you might not have HTML editors installed. If you installed Eclipse IDE for Java EE Developers it comes with the Web Tools Platform preinstalled. It has relatively good HTML editor (tag and attribute autocompletion with ctrl+space etc.) and even a "Web Page Editor" which lets you see the elements you are editing in a preview window. I guess you could try installing the Web Tools Platform (plugin) to your existing install.


Are there eclipse plugins that you can recommend for generating diagrams (UML, sequence) from Java code?

Answered By: Thomas Ahle ( 116)

ObjectAid UML Explorer

Is what I used. It is easily installed from the repository:

Name: ObjectAid UML Explorer

And produces quite nice UML diagrams:


Description from the website:

The ObjectAid UML Explorer is different from other UML tools. It uses the UML notation to show a graphical representation of existing code that is as accurate and up-to-date as your text editor, while being very easy to use. Several unique features make this possible:

  • Your source code and libraries are the model that is displayed, they are not reverse engineered into a different format.
  • If you update your code in Eclipse, your diagram is updated as well; there is no need to reverse engineer source code.
  • Refactoring updates your diagram as well as your source code. When you rename a field or move a class, your diagram simply reflects the changes without going out of sync.
  • All diagrams in your Eclipse workspace are updated with refactoring changes as appropriate. If necessary, they are checked out of your version control system.
  • Diagrams are fully integrated into the Eclipse IDE. You can drag Java classes from any other view onto the diagram, and diagram-related information is shown in other views wherever applicable.