3 Replies Latest reply: Aug 19, 2010 7:25 AM by EJP RSS

    jar file exception

    843804
      I created a jar file for the following java class.
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;
      public class WMSMS extends JFrame{
                
           public native void SendSMS(boolean a,boolean b,String SMSC, String phno,String msg);
           static {
                try
                {
                     System.loadLibrary("WMSMS");
                }
                catch (UnsatisfiedLinkError e)
                {
                     System.err.println("WMSMS.dll failed to load. \n" + e);
                     System.exit(1);
                }
           }
          public WMSMS() {
               JPanel contentpanel=(JPanel)getContentPane(); 
                 contentpanel.setLayout(null);
                 final JLabel jl=new JLabel("Phone NO:");
                 addelement(contentpanel, jl, 10, 20, 100, 20);
                 final JTextField jtxt=new JTextField(10);
                 addelement(contentpanel, jtxt, 80, 20, 100, 20);
                 final JLabel jl2=new JLabel("Message:");
                 addelement(contentpanel, jl2, 10, 50, 100, 20);
                 final JTextField jtxt2=new JTextField(10);
                 addelement(contentpanel, jtxt2, 80, 50, 100, 20);
                JButton btn=new JButton("Submit");
                addelement(contentpanel, btn, 10, 80, 100, 20);
          
              btn.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent ae) {
                                SendSMS(false,true,"",jtxt.getText(),jtxt2.getText());
                   }
                 });
             setTitle("Sample");
             setSize(300, 300);
             setLocation(new Point(150,150));
             setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
             setVisible(true);
      }
      private void addelement(Container c,Component e,int x,int y,int h,int w){
           e.setBounds(x, y, h, w);
           c.add(e);
      }
      public static void main (String[] args) {
        
         new WMSMS();
      }
      }
      I used the command :
      jar cvf WMSMS.jar WMSMS.class
      I created a shorcut lnk file using the the command:
      *255#"\J9\PPRO11\bin\j9.exe" "-jcl:ppro11" -Djava.library.path=\Windows "-classpath" "\Program Files\WMSMS\WMSMS.jar" "WMSMS"*
      to test the jar file in my windows mobile PDA.
      I placed the 'WMSMS.dll' in VC++ under the \Windows folder in the device.But on clicking the link it shows the following exception.

      Exception in thread "main" java.lang.UnsupportedClassVersionError: (WMSMS) bad major version at offset=6 at java.lang.ClassLoader.defineClassImpl(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.findClassImpl(Unknown Source) at java.net.URLClassLoader$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Unknown Source) at java.net.URLClassLoader.findClass(Unknown Source) at com.ibm.oti.vm.URLSystemClassLoader.findClass(Unknown Source)

      Isnt this something related to jar file?

      Edited by: shreya_ann on Aug 19, 2010 2:30 AM