0

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

2

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.