Bad version number in .class file

Developers
Elizabeth
2009-12-30
2013-05-15
  • Elizabeth

    Elizabeth - 2009-12-30

    Hi, I'm trying to run the sourcecode of the version 1.1.4r3 in Eclipse and I'm getting the next error, what should I do? I'm using JRE 1.5.0_17.

    Thanks.

    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at edu.stanford.genetics.treeview.TreeViewApp.<init>(TreeViewApp.java:108)
    at edu.stanford.genetics.treeview.app.LinkedViewApp.<init>(LinkedViewApp.java:53)
    at edu.stanford.genetics.treeview.app.LinkedViewApp.main(LinkedViewApp.java:247)
    at LinkedView.main(LinkedView.java:32)

     
  • Alok Saldanha

    Alok Saldanha - 2009-12-30

    It looks like it is erroring out the first time it tries to load a class file. It is possible that eclipse is running the project under a different JVM version than you are compiling for? This link may help you,

    http://ourcraft.wordpress.com/2009/01/08/bad-version-number-in-class-file/

    Also, under Preferences->Java->Compiler make sure that your compliance level is set to jdk 1.5.

     
  • Elizabeth

    Elizabeth - 2009-12-30

    Thanks for your answer. I downloaded jdk 6.0 and I solved the problem, but now I 've another problem… I'm trying to integrate Java Treeview to my proyect, I've a button in a panel and I want to open Java Treeview when I press that button. So I 've an "actionPerformed" method and I am calling the LinkedView main in this way:

                       LinkedView.main(args);
       

    where "args" is a String vector with the arguments received by the main of the class Panel:

                      public static void main( String args){…}

    When I press the button to execute the action performed method, I get the next error:

          Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at JavaTreeViewer.edu.stanford.genetics.treeview.UrlPresets.getPresetNames(UrlPresets.java:99)
    at JavaTreeViewer.edu.stanford.genetics.treeview.TreeViewApp.<init>(TreeViewApp.java:127)
    at JavaTreeViewer.edu.stanford.genetics.treeview.TreeViewApp.<init>(TreeViewApp.java:108)
    at JavaTreeViewer.edu.stanford.genetics.treeview.app.LinkedViewApp.<init>(LinkedViewApp.java:53)
    at JavaTreeViewer.edu.stanford.genetics.treeview.app.LinkedViewApp.main(LinkedViewApp.java:247)
    at JavaTreeViewer.LinkedView.main(LinkedView.java:33)
    at grafica.Panel$5.actionPerformed(Panel.java:418)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    How could I open Java Treeview from my application in a correct way?

    Thanks in advance.

     
  • Alok Saldanha

    Alok Saldanha - 2009-12-30

    The error indicates that the "root" member of UrlPresets is null, which is surprising since it should have been set on line 125 of TreeViewApp. I haven't been able to replicate the problem, so I can't be of much help. I made the follow test class which seems to run fine, does your code do something differently? (Incidentally, I recommend you call LinkedViewApp.main rather than LinkedView.main, which is only there for legacy purposes)

        import edu.stanford.genetics.treeview.app.LinkedViewApp;
        public class ButtonTest {
        public static final void main(final String argv) {
        JDialog jd = new JDialog();
        JButton but = new JButton("Push Me");
        but.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        LinkedViewApp.main(argv);
        }
        });
        jd.add(but);
        jd.setVisible(true);
        }
        }

     
  • Elizabeth

    Elizabeth - 2009-12-31

    I reorganized the packages and everything worked ok with the code you sent me.
    Thank you very much!
    Happy new year!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks