0

MANIFEST.MF

Manifest-Version: 1.0  
Created-By: 1.7.0_01 (Oracle Corporation)  
Main-Class: useDisplay

NOTE: There is a blank line after the Main-Class

display.java

public class display  
{  
    public void displayText()
    {
       System.out.println ("In displayText");
    }
}

useDisplay.java

public class useDisplay  
{
   public static void main (String args[])  
   {
      System.out.println ("In displayText");
   }
}

I ran the following commands:

javac *java
jar cf my1.jar MANIFEST.MF *class  
java -jar my1.jar  

I got the following errors:

Exception in thread "main" java.lang.NullPointerException at 
sun.launcher.LauncherHelper.getMainClassFromJar(LauncherHelper.java:399) 

at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:463)

This should be a very simple example. The program works without the jar file. I have no idea what it's complaining about.

tadpole
  • 1,209
  • 7
  • 19
  • 28

1 Answers1

0

I believe you have to add a -m to the jar command to use the MANIFEST.MF file you are specifying

jar cfm my1.jar MANIFEST.MF *class
El Guapo
  • 5,581
  • 7
  • 54
  • 82