为什么我的 Netbeans 无法创建新项目?

为什么我的 Netbeans 无法创建新项目?

我刚刚安装了 NetBeans 8.2,一切似乎都进展顺利。我几乎 100% 按照默认设置操作,除了删除了一两个我永远不需要的模块,并在第一次运行时更改了默认工作区。

现在它什么都不做。当我点击命令时File->New Project,什么都没有发生。当我点击其他几个命令时,什么都没有发生。

在我尝试创建项目后,IDE 日志确实显示了堆栈跟踪。这是该跟踪:

SEVERE [global]
java.lang.ClassNotFoundException: javax.activation.DataContentHandlerFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:222)
Caused: java.lang.ClassNotFoundException: javax.activation.DataContentHandlerFactory starting from ModuleCL@6c9be2b3[org.openide.awt] with possible defining loaders null and declared parents [org.netbeans.MainImpl$BootClassLoader@7a1ebcd8, ModuleCL@28e83a83[org.netbeans.api.annotations.common]]
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:224)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
Caused: java.lang.NoClassDefFoundError: javax/activation/DataContentHandlerFactory
    at org.openide.awt.QuickSearch.setUpSearch(QuickSearch.java:369)
    at org.openide.awt.QuickSearch.<init>(QuickSearch.java:107)
    at org.openide.awt.QuickSearch.attach(QuickSearch.java:197)
    at org.openide.awt.QuickSearch.attach(QuickSearch.java:125)
    at org.openide.explorer.view.TreeView$ExplorerTree.setupSearch(TreeView.java:1936)
    at org.openide.explorer.view.TreeView$ExplorerTree.<init>(TreeView.java:1753)
    at org.openide.explorer.view.TreeView.initializeTree(TreeView.java:299)
    at org.openide.explorer.view.TreeView.<init>(TreeView.java:238)
    at org.openide.explorer.view.TreeView.<init>(TreeView.java:228)
    at org.openide.explorer.view.BeanTreeView.<init>(BeanTreeView.java:98)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesBeanTreeView.<init>(TemplatesPanelGUI.java:679)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel.createComponent(TemplatesPanelGUI.java:729)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$ExplorerProviderPanel.initGUI(TemplatesPanelGUI.java:644)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$ExplorerProviderPanel.<init>(TemplatesPanelGUI.java:535)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel.<init>(TemplatesPanelGUI.java:719)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel.<init>(TemplatesPanelGUI.java:719)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI.initComponents(TemplatesPanelGUI.java:421)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI.<init>(TemplatesPanelGUI.java:156)
    at org.netbeans.modules.project.ui.ProjectTemplatePanel.getComponent(ProjectTemplatePanel.java:187)
    at org.netbeans.modules.project.ui.NewProjectWizard.createTemplateChooser(NewProjectWizard.java:104)
    at org.openide.loaders.TemplateWizard.templateChooser(TemplateWizard.java:320)
    at org.openide.loaders.TemplateWizardIterImpl.firstPanel(TemplateWizardIterImpl.java:87)
    at org.openide.loaders.TemplateWizardIterImpl.current(TemplateWizardIterImpl.java:144)
    at org.openide.loaders.TemplateWizardIteratorWrapper.current(TemplateWizardIteratorWrapper.java:92)
    at org.openide.WizardDescriptor.updateStateOpen(WizardDescriptor.java:844)
    at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:822)
    at org.openide.loaders.TemplateWizard.updateState(TemplateWizard.java:761)
    at org.netbeans.modules.project.ui.NewProjectWizard.updateState(NewProjectWizard.java:84)
    at org.openide.WizardDescriptor._updateState(WizardDescriptor.java:800)
    at org.openide.WizardDescriptor.access$200(WizardDescriptor.java:92)
    at org.openide.WizardDescriptor$Listener.stateChanged(WizardDescriptor.java:2180)
    at org.openide.util.WeakListenerImpl$Change.stateChanged(WeakListenerImpl.java:356)
    at org.openide.loaders.TemplateWizardIterImpl.run(TemplateWizardIterImpl.java:275)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.project.ui.actions.NewProject$1
java.lang.ClassNotFoundException: javax.activation.DataContentHandlerFactory
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:222)
Caused: java.lang.ClassNotFoundException: javax.activation.DataContentHandlerFactory starting from ModuleCL@6c9be2b3[org.openide.awt] with possible defining loaders null and declared parents [org.netbeans.MainImpl$BootClassLoader@7a1ebcd8, ModuleCL@28e83a83[org.netbeans.api.annotations.common]]
    at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:224)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
Caused: java.lang.NoClassDefFoundError: javax/activation/DataContentHandlerFactory
    at org.openide.awt.QuickSearch.setUpSearch(QuickSearch.java:369)
    at org.openide.awt.QuickSearch.<init>(QuickSearch.java:107)
    at org.openide.awt.QuickSearch.attach(QuickSearch.java:197)
    at org.openide.awt.QuickSearch.attach(QuickSearch.java:125)
    at org.openide.explorer.view.TreeView$ExplorerTree.setupSearch(TreeView.java:1936)
    at org.openide.explorer.view.TreeView$ExplorerTree.<init>(TreeView.java:1753)
    at org.openide.explorer.view.TreeView.initializeTree(TreeView.java:299)
    at org.openide.explorer.view.TreeView.<init>(TreeView.java:238)
    at org.openide.explorer.view.TreeView.<init>(TreeView.java:228)
    at org.openide.explorer.view.BeanTreeView.<init>(BeanTreeView.java:98)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesBeanTreeView.<init>(TemplatesPanelGUI.java:679)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel.createComponent(TemplatesPanelGUI.java:729)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$ExplorerProviderPanel.initGUI(TemplatesPanelGUI.java:644)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$ExplorerProviderPanel.<init>(TemplatesPanelGUI.java:535)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel.<init>(TemplatesPanelGUI.java:719)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI$CategoriesPanel.<init>(TemplatesPanelGUI.java:719)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI.initComponents(TemplatesPanelGUI.java:421)
    at org.netbeans.modules.project.ui.TemplatesPanelGUI.<init>(TemplatesPanelGUI.java:156)
    at org.netbeans.modules.project.ui.ProjectTemplatePanel.getComponent(ProjectTemplatePanel.java:187)
    at org.netbeans.modules.project.ui.NewProjectWizard.createTemplateChooser(NewProjectWizard.java:104)
    at org.openide.loaders.TemplateWizard.templateChooser(TemplateWizard.java:320)
    at org.openide.loaders.TemplateWizardIterImpl.firstPanel(TemplateWizardIterImpl.java:87)
    at org.openide.loaders.TemplateWizardIterImpl.current(TemplateWizardIterImpl.java:144)
    at org.openide.loaders.TemplateWizardIteratorWrapper.current(TemplateWizardIteratorWrapper.java:92)
    at org.openide.WizardDescriptor.updateStateOpen(WizardDescriptor.java:844)
    at org.openide.WizardDescriptor.updateState(WizardDescriptor.java:822)
    at org.openide.loaders.TemplateWizard.updateState(TemplateWizard.java:761)
    at org.netbeans.modules.project.ui.NewProjectWizard.updateState(NewProjectWizard.java:84)
    at org.openide.loaders.TemplateWizard$2.run(TemplateWizard.java:497)
    at org.openide.loaders.TemplateWizard$2.run(TemplateWizard.java:494)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event$1AWTWorker.run(NbMutexEventProvider.java:156)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
    at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[catch] at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
INFO [org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogParser]: Unpaired license 00000008 without any module.
INFO [null]: Last record repeated again.

答案1

请说明 jdk 版本。就我而言,我使用下一个解决方案:NetBeans 8.2 与 jdk 9 不兼容。我暂时重命名目录 jdk-9 并在重新启动时更改默认 jdkhome。或者在 etc\netbeans.conf 中更改 netbeans_jdkhome。

答案2

也许这也有帮助。

JDK 9 还不能与 Netbeans 8.2 兼容。你至少需要JDK 8JRE 8

打开命令行并输入“javac -version”来查看 JDK 版本。

在 netbeans 中,在“工具”选项卡下选择“java-platforms”,然后通过“添加平台”(jdk 文件夹)将 JDK 8 添加为默认设置。或者尝试重新安装 netbeans,并在安装时选择 JDK 8。

一些答案这里这里

相关内容