Eclipse: Silent Startup Error

Yesterday Eclipse started to show a strange problem. Invoking eclipse.exe would display the splash screen and would exit after that!

Since the program would not even display an error message, I first tried invoking it from the console to see any errors. It would exit without writing anything on the console. I then thought it might be a corruption of settings or workspace, but cleaning those did not help either. I then looked at the runtime options I could pass to eclipse.exe and tried those options related to a clean invocation and logging. Nothing helped.

I had almost given up when I noticed the eclipsec.exe in the same directory. This turned out to be a console executable of Eclipse. Invoking this finally showed the problem:

C:\Program Files\Eclipse>eclipsec.exe
Error occured during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

So, there was a problem with the JVM! I downloaded and installed the latest JRE and Eclipse worked fine after that! :-)

Ubuntu: Javadoc

The Javadoc tool is used to generate documentation from comments in Java source code. To generate documentation in Eclipse, choose ProjectGenerate Javadoc. You may be required to provide the path to the javadoc binary in the Javadoc command field. This is typically /usr/bin/javadoc.

On a typical installation of Eclipse in Ubuntu 9.10 (Karmic Koala), you may not find the javadoc binary. To get this binary, install the openjdk-6-jdk package.

Eclipse: Add Java


I use the Eclipse IDE for C/C++, primarily for working with Python using the PyDev package. I recently had to try some Java code. Here is how to update Eclipse IDE for C/C++ to build Java:

  1. Make sure all the existing components of Eclipse are updated. To do this choose HelpCheck for Updates.
  2. To install Java, choose HelpInstall New Software. From the Work with dropdown, choose EPP Packages Repository. Expand the Uncategorized section below and choose EPP Java Package. Click Next and navigate through the install wizard to the finish.

Eclipse: Find and Search

Eclipse is a strange beast. To search for a string, I was using the common Ctrl+F keyboard shortcut. This would pop up the familiar Find/Replace dialog. But soon, I was looking for a way to search through the entire project or workspace and could not find any way to do that using the Find/Replace dialog.

It turns out that there a larger, more complex Search feature in Eclipse! Why they would keep both Find and Search instead of combining them (like Visual Studio), that I cannot fathom. Ctrl+H is the default keyboard shortcut for this Search and indeed it shows up with custom searches for all the languages supported by Eclipse. (I use the PyDev Search, since I use Eclipse for Python code.)

The editor does not show the first matching search result (like in Find/Replace), but shows the Search results in a new Search window at the bottom. All in all, very odd business. But, at least I can now search through the entire project/workspace.

Eclipse: Console Buffer Size

The default size of the console buffer in Eclipse is pretty small (80,000 characters). If your code is very verbose with its log messages, this console buffer can overrun very easily. The console silently removes all the lines that overrun (in FIFO order).

To increase or change the buffer size, head over to WindowsPreferencesRun/DebugConsoleConsole buffer size.

Eclipse: Split Windows

I like working with split editor windows when comparing code from 2 different sections of a file or different files. This is easy to do in Visual Studio (see here). It is just as easy in Eclipse too, though not obvious if you merely look through the menus.

[ To split a window, just grab hold of a tab and pull it to the side until it turns into a black arrow. ]

[ Leave it and it turns into a new window with a new tab group. ]

To have split windows with the same file: Choose WindowNew Editor. That creates a new tab of the open file. Pull that tab as above to split the window.

For a horizontal split, pull the tab to the bottom of the window.