JDK-7068742 : NullPointerException in sun.launcher.LauncherHelper.getMainClassFromJar
  • Type: Bug
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2011-07-20
  • Updated: 2012-03-20
  • Resolved: 2011-07-20
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
java -jar JarWithNoMainClass.jar

results in:

Exception in thread "main" java.lang.NullPointerException
        at sun.launcher.LauncherHelper.getMainClassFromJar(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
User-friendly error message that explains that the JAR does not specify the class to be executed.

REPRODUCIBILITY :
This bug can be reproduced always.