Monthly Archives: November 2010

Useful Eclipse Shortcuts

I do a lot of programming on a laptop without a mouse, and Eclipse shortcuts are imperative if I want to remain productive. Even when I do have a mouse, using keyboard shortcuts is usually faster than trying to click around for what I need. Here is a list of shortcuts that I use often.

Ctrl+Shift+l – Show Shortcuts

F3 – Go to Definition
Alt+Back – Back
Alt+Forward – Forward
Ctrl+l – Go to Line
Ctrl+m – Maximize/Minimize Active View or Editor
Ctrl+Home – Go to Beginning of File
Ctrl+End – Go to End of File

Ctrl+1 – Quick Fix (i.e., create method if you are calling one that does not exist)
Ctrl+7 – Toggle comment
Ctrl+d – Delete line
Ctrl+Shift+f – Format
Alt+Up – Move Lines Up
Alt+Down – Move Lines Down
F2 – Show Tooltip Description

F11 – Debug
Ctrl+F11 – Run
F5 – Step Into
F6 – Step Over
F7 – Step Out
F8 – Continue
Ctrl+Shift+b – Toggle Breakpoint

F6 – Turn On/Off Trackball
Ctrl+F12 – Switch to Next Orientation (Portrait, Landscape)

java.lang.RuntimeException: Stub!

I recently tried to run my junit tests to ensure that I didn’t break anything after monkeying around with my code, and I ran into the following error:

Exception in thread "main" java.lang.RuntimeException: Stub!

Here’s my code that runs my tests:

public class RunTestSuite {
public static void main(String[] a) {;

public static Test suite() {

TestSuite suite = new TestSuite();
return suite;


The stack trace pointed to line 8, so I didn’t know what to make of it since I just had this setup correctly, and TestSuite is a JUnit thing.

Googling mostly resulted in issues with using an Android Test Project (I’m not) and running the tests in your desktop’s JVM instead of the actual device’s (see here).

Eventually, though, I found this post that informed me that the JUnit library needs to be at the top of the test project’s build order.

Here are the steps to change the build order in Eclipse:

  1. Right-click your test project
  2. Click Bulid Path->Configure Build Path…
  3. Click the Order and Export tab
  4. Select the JUnit reference
  5. Click the Top button