Reputation: 7396
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
Upvotes: 0
Views: 195
Reputation: 122414
Main-Class:hello.java
The Main-Class
value should be the fully qualified class name, not the file name, e.g. for
package com.example;
public class hello {
you need Main-Class: com.example.hello
Upvotes: 1