I created a executable jar using command

jar cvfm swingDemo.jar manifest.txt *.class

But when i open it then it does not work and also do not show any error message.

I used 'extcheck' tool on this jar then it showed following message:
'The target file does not have specification title'.
what does that mean..? and what to do to make it work..? ....thnx for help.!

7 Years
Discussion Span
Last Post by NormR1

Need more info.
What is in the manifest file?

What is in the jar file? Use any utility that can open a zip file to view its contents.

Open a command prompt window, change to the folder with the swingDemo.jar file and enter this command:
java -jar swingDemo.jar
Copy and paste there the contents of the console window.
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.


I did as u told and following message in cmd prompt window...

J:\prgs>cd new

J:\prgs\new>java -jar swingDemo.jar
Exception in thread "main" java.lang.NoClassDefFoundError: win
        at swingDemo.<init>(swingDemo.java:9)
        at swingDemo.main(swingDemo.java:32)
Caused by: java.lang.ClassNotFoundException: win
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 2 more


I also used unziip tool and found following inside swingDemo folder:
->folder named META-INF and swingDemo.class
->inside META-INF a manifest file which i created and had following contents:

Manifest-Version: 1.0
Created-By: 1.6.0_20 (Sun Microsystems Inc.)
Main-Class: swingDemo

Exception in thread "main" java.lang.NoClassDefFoundError: win
at swingDemo.<init>(swingDemo.java:9)

The JVM is looking for a class named: win
At line 9 in the SwingDemo class the code must reference that class.
You need to add the class file for win to the jar file.


The class win which u r talking about is used to make use of adapter class, i can not create a seprate class file for win.The programe is working properly when compiled and run in command prompt.Code of my programme is given below:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class swingDemo extends JFrame implements ActionListener
  public swingDemo()
   addWindowListener(new win(this));
   FlowLayout flow=new FlowLayout();
   JTextField j=new JTextField("TEXT:",20);
   JButton b=new JButton("EXIT");
   public void actionPerformed(ActionEvent e)
public static void main(String st[])
   swingDemo d=new swingDemo();

class win extends WindowAdapter
  swingDemo sd;
  public win(swingDemo sd)
  public void windowClosing(WindowEvent e)

i can not create a seprate class file for win.

The compiler should do that.

Where is the class file for the win class?
After you do: javac swingDemo.java
What class files are in the folder?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.