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.!

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

J:\prgs\new>

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();
   setLayout(flow);
   setSize(300,300);
   setVisible(true);
   setTitle("FRAME");
   JTextField j=new JTextField("TEXT:",20);
   add(j);
   JButton b=new JButton("EXIT");
   add(b);
   b.addActionListener(this);
  }
   public void actionPerformed(ActionEvent e)
    {
      	System.exit(1);
    }
  
  
public static void main(String st[])
 {
   swingDemo d=new swingDemo();
 }
}

class win extends WindowAdapter
{
  swingDemo sd;
  public win(swingDemo sd)
   {
      this.sd=sd;
   }
  public void windowClosing(WindowEvent e)
   {
     System.exit(1);
   }	 
}

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.