This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Better description of errors due to loading classes from a newer JDK | ||
---|---|---|---|
Product: | guibuilder | Reporter: | genericprodigy <genericprodigy> |
Component: | Code | Assignee: | issues@guibuilder <issues> |
Status: | NEW --- | ||
Severity: | blocker | CC: | exceptions_reporter, jmsoft, rafaelsoa |
Priority: | P3 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: | |
Attachments: |
messages.log
Log file from genericprodigy. |
Description
genericprodigy
2008-12-01 08:24:37 UTC
Thank you for your report. Are you using official apple java 1.6 on macosx 10.4 or ported java 1.6 aka Soylatte on macosx I'm using the official Apple SDK on Leopard. So Mac OS X 10.5.5. Created attachment 74343 [details]
messages.log
Product Version: NetBeans IDE Dev (Build 200812010201) Java: 1.6.0_07; Java HotSpot(TM) 64-Bit Server VM 1.6.0_07-b06-57 System: Mac OS X version 10.5.5 running on x86_64; MacRoman; en_US (nb) Userdir: /netbeans/70/user Steps: 1. Open j2se project. 2. Create new jFrame. 3. Create new jPanel. (Don't compile) 4. Select panel and add it into Palette. 5. Drag the panel from Palette into the frame => "Cannot load component class a.NewJPanel from project: ..." 6. Compile project. Everything works fine now. To reporter: can this be your case? Does compiling project resolve the issue? This is quite like my issue. I did add it to the panel but this did not resolve my issue. As stated previously, compiling does not resolve the issue either - in that case it wouldn't be much of an issue. I meant palette rather than panel. But the same issue still occurs. Please try to compile entire project - select project root and invoke "Build" popup menu action. Then everything should work as expected. Please confirm this. Thanks in advance. I tried that and still the same result. In project properties the Source/Binary format is set to JDK 6 as well. This seems to be the property that makes the difference. Please, attach your messages.log, file is located inside nb userdir ( {netbeans-user-dir}\var\log\messages.log ) Maybe log file will help us to find what is wrong. We are able to use nb 6.5 form designer to design and use custom component on macosx 10.5 and jdk 6 and on mac os x 10.4 using jdk 1.5. From our point of view there is no data loss or critical usability problem, that is why I set priority to P3. I've changed "Source/Binary Format" to "JDK 1.6" and it works either. Created attachment 74409 [details]
Log file from genericprodigy.
Product Version: NetBeans IDE 6.5 (Build 200811100001) Java: 1.5.0_16; Java HotSpot(TM) Client VM 1.5.0_16-133 System: Mac OS X version 10.5.5 running on i386; MacRoman; en_GB (nb) Userdir: /Users/pjlaszkowicz/.netbeans/6.5 Could it be the fact that my default version of Java on my machine is still 5? That really shouldn't matter though as NetBeans has asked what version of Java I'm using for that particular application. I think, that you are right. There is something wrong with JDKs. Form is innocent! :D It looks like that classes are
build by j6 compiler but used by j5 runtime. Or something like this. All troubles are caused by ...
>>> Caused: java.lang.UnsupportedClassVersionError: Bad version number in .class file ...
Is this something to be fixed in NetBeans then? As it seems to be an anomoly of the IDE rather than the fact the developer should be changing his/her default runtime. So if you run NetBeans on Java 5 but compile your project in Java 6 (with binary format set to Java 6) then this cannot work. Java 5 can't load classes from Java 6 (with higher version). Nothing can be done with that. Form editor could just be more helpful providing a hint what might be the problem. Yes, I think that is the only solution then. Can a change be made as part of this then? Just to give a better hint; I'll change my default instance of Java to 6 (I assume that's the recommended solution). Changing to enhancement. As reports of bug 216636 show, this may manifest not only in form opening, or adding a component, but also in binding support: java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(ClassLoader.java:0) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.lang.ClassLoader.defineClass(ClassLoader.java:520) at org.netbeans.modules.form.project.ProjectClassLoader.findClass(ProjectClassLoader.java:158) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.netbeans.modules.form.project.FormClassLoader.findClass(FormClassLoader.java:79) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at java.lang.Class.forName0(Class.java:0) at java.lang.Class.forName(Class.java:242) at org.netbeans.modules.form.project.ClassPathUtils.loadClass(ClassPathUtils.java:95) at org.netbeans.modules.form.FormUtils.loadClass(FormUtils.java:1430) at org.netbeans.modules.form.FormUtils.loadClass(FormUtils.java:1437) at org.netbeans.modules.form.BindingDesignSupport.treeToType(BindingDesignSupport.java:518) at org.netbeans.modules.form.BindingDesignSupport.access$200(BindingDesignSupport.java:82) at org.netbeans.modules.form.BindingDesignSupport$3.run(BindingDesignSupport.java:626) at org.netbeans.modules.form.BindingDesignSupport$3.run(BindingDesignSupport.java:632) at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:680) at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:607) at org.netbeans.modules.form.BindingDesignSupport.determineTypeParameter(BindingDesignSupport.java:576) at org.netbeans.modules.form.BindingDesignSupport.determineType(BindingDesignSupport.java:556) at org.netbeans.modules.form.BindingCustomizer$ExpressionNode.(BindingCustomizer.java:1284) at org.netbeans.modules.form.BindingCustomizer.sourceComboActionPerformed(BindingCustomizer.java:1112) at org.netbeans.modules.form.BindingCustomizer.access$1200(BindingCustomizer.java:82) at org.netbeans.modules.form.BindingCustomizer$FormListener.actionPerformed(BindingCustomizer.java:1027) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1197) at javax.swing.JComboBox.setSelectedItem(JComboBox.java:561) at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:597) at org.netbeans.modules.form.BindingCustomizer.setBindingToUI(BindingCustomizer.java:392) at org.netbeans.modules.form.BindingCustomizer.setBinding(BindingCustomizer.java:273) at org.netbeans.modules.form.BindingProperty$BindingPropertyEditor.getCustomEditor(BindingProperty.java:343) *** Bug 216636 has been marked as a duplicate of this bug. *** This improved slightly by improving the way exceptions from custom classes are reported to the user (bug 83467 and bug 121616), but it would deserve a special detection and reporting to the user. > but it would deserve a special detection and reporting to the user.
...for this specific case of class version mismatch error.
*** Bug 230644 has been marked as a duplicate of this bug. *** *** Bug 267739 has been marked as a duplicate of this bug. *** Just to make this quite clear: The UnsupportedClassVersionError can be avoided by running NetBeans on a newer Java version. There is no other way to fix it. This enhancement report is here to provide a better error message that would explain that to the user. |