PDA

View Full Version : About Netbeans




KeeeeenW
Jun 16, 2009, 04:51 PM
Anyone using Netbeans?

I can not set up Class in the package, and I am using the newest version of Macbook Pro 13-inch and have the newest version of JAVA.

Anyone has the same problem??



angelwatt
Jun 16, 2009, 05:17 PM
I use it and don't have problems creating classes. Maybe you should elaborate on how you're going about it and provide any error messages that you receive.

KeeeeenW
Jun 16, 2009, 08:48 PM
java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:209)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at sun.misc.Service$LazyIterator.next(Service.java:271)
at javax.script.ScriptEngineManager.initEngines(ScriptEngineManager.java:127)
at javax.script.ScriptEngineManager.access$000(ScriptEngineManager.java:55)
at javax.script.ScriptEngineManager$1.run(ScriptEngineManager.java:98)
at java.security.AccessController.doPrivileged(Native Method)
at javax.script.ScriptEngineManager.init(ScriptEngineManager.java:96)
at javax.script.ScriptEngineManager.<init>(ScriptEngineManager.java:69)
at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.engine(ScriptingCreateFromTemplate Handler.java:129)
at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.accept(ScriptingCreateFromTemplate Handler.java:70)
at org.openide.loaders.MultiDataObject.handleCreateFromTemplate(MultiDataObject.java:707)
at org.openide.loaders.DataObject$CreateAction.run(DataObject.java:1288)
at org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:258)
at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:120)
at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:509)
at org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:270)
at org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:873)
at org.openide.loaders.DataObject.createFromTemplate(DataObject.java:805)
at org.openide.loaders.DataObject.createFromTemplate(DataObject.java:785)
at org.netbeans.modules.java.project.NewJavaFileWizardIterator.instantiate(NewJavaFileWizardIterator.ja va:158)
at org.netbeans.modules.form.wizard.TemplateWizardIterator.instantiate(TemplateWizardIterator.java:125)
at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1018)
at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:588)
at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:409)
at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:248)
at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:161 )
at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1527)
at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1481)
at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:127)
at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2052)
at org.openide.WizardDescriptor$Listener$2.run(WizardDescriptor.java:2101)
at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1456)
at org.openide.WizardDescriptor.access$1300(WizardDescriptor.java:127)
at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2108)
Caused: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:451)
Caused: java.lang.reflect.UndeclaredThrowableException
at $Proxy20.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:180)
at java.awt.Dialog$1.run(Dialog.java:535)
at java.awt.Dialog$2.run(Dialog.java:565)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:563)
at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:985)
at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1019)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1007)
at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:115)
at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
at org.openide.util.Mutex.readAccess(Mutex.java:268)
at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:992)
at java.awt.Component.show(Component.java:1302)
at java.awt.Component.setVisible(Component.java:1255)
at org.openide.loaders.TemplateWizard.instantiateImpl(TemplateWizard.java:495)
at org.openide.loaders.TemplateWizard.instantiate(TemplateWizard.java:374)
at org.netbeans.modules.project.ui.actions.NewFile.doPerform(NewFile.java:154)
at org.netbeans.modules.project.ui.actions.NewFile.access$200(NewFile.java:80)
at org.netbeans.modules.project.ui.actions.NewFile$PopupListener.actionPerformed(NewFile.java:349)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:104)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


Exception is here

Woei
Jun 17, 2009, 12:52 PM
java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory
[...]
Exception is here

The class that couldn't be instantiated is ScriptEngineFactory (http://java.sun.com/javase/6/docs/api/javax/script/ScriptEngineFactory.html), which is a service only available in Java 1.6. Because Java 1.5 is the default JDK on Apple machines, you're probably running NetBeans and applications launched from NetBeans with 1.5. The standard library (rt.jar) of that Java version does not contain that class.

The solution is to select a different JRE to run and compile your applications on. First off, you'll have to make the Java 6 JDK known to NetBeans. This can be done by selecting the Tools menu item and then 'Java Platforms'. Add JDK 1.6 by pointing the file manager that pops up to /System/Library/Frameworks/JavaVM.framework/Versions. The next step involves making your current project use this new JDK: control click on your project root, go to properties and then 'Libraries'. Toggle the JDK to use.

KeeeeenW
Jun 17, 2009, 10:37 PM
The class that couldn't be instantiated is ScriptEngineFactory (http://java.sun.com/javase/6/docs/api/javax/script/ScriptEngineFactory.html), which is a service only available in Java 1.6. Because Java 1.5 is the default JDK on Apple machines, you're probably running NetBeans and applications launched from NetBeans with 1.5. The standard library (rt.jar) of that Java version does not contain that class.

The solution is to select a different JRE to run and compile your applications on. First off, you'll have to make the Java 6 JDK known to NetBeans. This can be done by selecting the Tools menu item and then 'Java Platforms'. Add JDK 1.6 by pointing the file manager that pops up to /System/Library/Frameworks/JavaVM.framework/Versions. The next step involves making your current project use this new JDK: control click on your project root, go to properties and then 'Libraries'. Toggle the JDK to use.


Thank you very very very much!! I fixed it! Why they do not make 1.6 as default???

rkj
Jun 22, 2009, 06:19 AM
The solution is to select a different JRE to run and compile your applications on. First off, you'll have to make the Java 6 JDK known to NetBeans. This can be done by selecting the Tools menu item and then 'Java Platforms'. Add JDK 1.6 by pointing the file manager that pops up to /System/Library/Frameworks/JavaVM.framework/Versions. The next step involves making your current project use this new JDK: control click on your project root, go to properties and then 'Libraries'. Toggle the JDK to use.

And what can I do if I have older MacBook (with 32bit Intel Core Duo) and the only running version is Java 1.5?

mathcolo
Jun 22, 2009, 02:17 PM
And what can I do if I have older MacBook (with 32bit Intel Core Duo) and the only running version is Java 1.5?

Then you're out of luck :(

elppa
Jun 22, 2009, 04:21 PM
Then you're out of luck :(

Buy Snow Leopard in September and get 32 bit Java 6.

Meek Wriggle
Jun 22, 2009, 05:54 PM
Fix from the Netbeans forums (http://forums.netbeans.org/post-39018.html);

From http://swik.net/Java/Technorati+Java+Feed/NetBeans+Problems+after+Mac+OS+Java+Update/czt9j

This worked for me...

After installing "Java for Mac OS X 10.5 Update 4" I experienced a lot of trouble with NetBeans,e.g. I could not create a new project, or a new Java class in existing projects. What helped, was using JDK 1.6 instead of JDK 1.5. To do this edit the file netbeans.conf and change apply this change:

Find this line

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home

and change to

netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home


The netbeans.conf file is found by Control-click on Applications/Netbeans/Netbeans 6.x/Show Package Contents/Resources/Netbeans/etc/netbeans.conf

He doesn't explain it too well in that last sentence; when you've found the Netbeans 6.x icon to bring up "Show Package Contents". The line you need to change is about two thirds of the way down the file and it's really just a simple case of changing the 5 in 1.5 to a 6 (so it becomes 1.6).

This fix worked fine for me on my MacBook (although the post of the fix claims it didn't work on a MacBook Pro, despite working on two of his other Macs).

rkj
Jun 23, 2009, 01:30 AM
This fix worked fine for me on my MacBook (although the post of the fix claims it didn't work on a MacBook Pro, despite working on two of his other Macs).

It works on 64-bits processors and not on 32-bits. It does not matter if it is MacBook or MacBook Pro :)

For me, installing nightly build has helped:
http://deadlock.netbeans.org/hudson/job/release67/

Woei
Jun 23, 2009, 04:06 PM
And what can I do if I have older MacBook (with 32bit Intel Core Duo) and the only running version is Java 1.5?

Bug Apple to release a 32-bit version of Java 6 ?

If you really, really want to develop against a Java 6 rt.jar library, you can also try the Darwinified BSD-port of Java 6: SoyLatte (http://landonf.bikemonkey.org/static/soylatte/). It doesn't have the fancy GUI, is unsupported, but it does have the Metal and Ocean PLAFs (albeit on X11) and runs on 32-bit Intel chips.

elppa
Jun 24, 2009, 03:13 AM
Bug Apple to release a 32-bit version of Java 6 ?

If you really, really want to develop against a Java 6 rt.jar library, you can also try the Darwinified BSD-port of Java 6: SoyLatte (http://landonf.bikemonkey.org/static/soylatte/). It doesn't have the fancy GUI, is unsupported, but it does have the Metal and Ocean PLAFs (albeit on X11) and runs on 32-bit Intel chips.

They will (edit: probably!) be releasing it in Septemeber. There is a screenshot of the Java Preferences for Snow Leopard lurking around which clearly says Java SE 6 (32 bit).

Here you go:

Link (http://www.flickr.com/photos/skyzyx/3619986844/in/set-72157619645869110/)

guitarking117
Aug 26, 2009, 09:52 PM
Just looked at Apple's system requirements for Snow Leopard. You must have a Mac with a 64-bit processor to install Snow Leopard. I think this defacto means there won't be a 32-bit Java 6 VM in Snow Leopard. :(

angelwatt
Aug 27, 2009, 08:17 AM
Just looked at Apple's system requirements for Snow Leopard. You must have a Mac with a 64-bit processor to install Snow Leopard. I think this defacto means there won't be a 32-bit Java 6 VM in Snow Leopard. :(

Don't worry, you were misinformed. 32-bit Java 6 VM will be fine.

wrldwzrd89
Aug 27, 2009, 08:34 AM
Don't worry, you were misinformed. 32-bit Java 6 VM will be fine.
Actually, Apple never released a 32-bit Java 6 version. 64-bit Intel only.

Anyway... regarding NetBeans I've had this problem too. I used the temporary fix detailed several posts up until I updated to NetBeans 6.7. That fixed the issues I was having for good (NetBeans 6.7.1 is now available, and I highly recommend updating).

elppa
Aug 27, 2009, 09:10 AM
Actually, Apple never released a 32-bit Java 6 version. 64-bit Intel only.

Apple is releasing 32 bit Java 6 to the public tomorrow as part of Snow Leopard.

wrldwzrd89
Aug 27, 2009, 09:15 AM
Apple is releasing 32 bit Java 6 to the public tomorrow as part of Snow Leopard.
Oh really? That's surprising, I never thought Apple would do this.