Community
Participate
Working Groups
Build Identifier: 20100617-1415 I have a simple runnable class (uses "public static void main(.....). The class has a static variable which gets its value from using an other class in my case the line of code is as follows: "private final static String TERM_ID = DBUtilsHS.lookupUserByName(hsSession, HS_TERM_NAME).getUserid().toString();" The line of code above throws a null pointer exception which causes the IDE to show the following error message box: "Could not find the main class. Program will exit" IMHO this is just wrong! because it's misleading - the IDE can actually find the main class (it exists in the build directory as it should), it just can't instantiate it because of a prior exception thrown in a static variable. Reproducible: Always Steps to Reproduce: 1. Create a simple runnable java class (using (static public void main....) 2. Create a static variable which executes a method which throws a NullPointerException 3. See the misleading error message box 4. fix it Thanks :-)
Moving to JDT/Debug Testcase: ----------8<---------------------------------------------- package test; public class Test { private static final String abc = test().toString(); public static Object test(){ return null; } } ----------8<----------------------------------------------
(In reply to comment #1) > Moving to JDT/Debug > > Testcase: Correction ----------8<---------------------------------------------- package test; public class Test { private static final String abc = test().toString(); public static Object test(){ return null; } public static void main(String[] args) { } } ----------8<----------------------------------------------
The error is reported from the Java VM, not Eclipse.