i created an executable jar file using the command jar cmf <text-file-points-to-main-class> <archive-name.jar> as a result an executable jar file is produced, but when i attempted to open that executable jar using java -jar file-name.jar the following exception is raised
Exception in thread "main" java.lang.NullPointerException
at sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:399)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:463)
the <text-file-points-to-main-class> actually contains—>Main-Class:hello.java also i tried(hello without .java)
i can’t point what exactly is the problem ? note that the class file works properly
The
Main-Classvalue should be the fully qualified class name, not the file name, e.g. foryou need
Main-Class: com.example.hello