How to run the main method of an Android Activity class?
<p>I'd would like to examine a private method of an <strong>Android Activity</strong> by executing it within the Activity's <strong><em>public static void main(String[] args)</em></strong> method which I created.</p>

<p>I use <strong>Eclipse ADT</strong> and my naive approach of running the <em>Activity</em> as a <strong>Java application</strong> resulted in:</p>

<blockquote>
  <p>A fatal error has been detected by the Java Runtime Environment:<br>
  Internal Error (classFileParser.cpp:3174), pid=2936, tid=2980<br>
  Error: ShouldNotReachHere()</p>
</blockquote>

<p>So I looked at the <strong>Run Configuration</strong> and found out that <strong>Android 3.1</strong> is the sole entry in the <strong>Bootstrap Entries</strong> section of <strong>Classpath</strong>. I managed to configure the <strong>Build Path</strong> of the project so that the <strong>JRE</strong> is in the <strong>Bootstrap Entries</strong> too. Then I removed the <strong>Android 3.1</strong> entry and added <strong>android.jar</strong> to <strong>User Entries</strong>.</p>

<p>The result of executing the <strong>Run Configuration</strong> is a RuntimeException:</p>

<blockquote>
  <p>Exception in thread "main" java.lang.RuntimeException: Stub!<br>
    at android.content.Context.(Context.java:4)</p>
</blockquote>

<p><strong>An alternative</strong> of executing some tests would be to fire up a <strong>JUnit</strong> test. But in the case of a <strong>private method</strong> this is cumbersome.</p>

<p>Is there a way to successfully run the main method of an Android Activity class?</p>
