Search code examples
c++netbeansnetbeans-plugins

Error installing C/C++ plugin in Netbeans 12.4 with JDK 16 in Windows 10


I'd like to install C/C++ plugin in Netbeans 12.4 with JDK 16 in Windows 10.
I have an error during the install C/C++ plugin.

Windows: 10
Netbeans: 12.4
JDK: 16.0.1

I attached photos:

enter image description here


Solution

  • You are getting this problem because NetBeans is using JDK 16 to download a plugin, where that download process relies on the unpack200 tool which was deprecated in JDK 11, and removed in JDK 14.

    Since NetBeans 12.4 supports three JDK releases (8, 11 and 16), the solution is to:

    • Temporarily switch the default platform to JDK 8 or JDK 11, since they support the unpack200 API.
    • Download and install the C/C++ plugin while NetBeans is running under JDK 8 or 11.
    • Revert NetBeans to use JDK 16 once the C/C++ plugin is installed successfully.

    See How to set the JDK Netbeans runs on? for details on switching to JDK 8 or 11, and then reverting back to JDK 16.

    Once NetBeans has been configured to use JDK 8 or 11 (I chose 8):

    • Restart NetBeans, and select Tools > Plugins > Settings > Add to add http://updates.netbeans.org/netbeans/updates/8.2/uc/final/distribution/catalog.xml.gz as an update center URL for plugins.

    • Click the Available Plugins tab, check C/C++, and then click the Install button to install the plugin:

      InstallCPPplugin

    • Once the plugin has been installed, select File > New Project..., then select C/C++ from the Categories list to verify that the plugin installation worked:

      CPPprojectTypes

    • If all nine C/C++ project types are listed (as shown above) then configure NetBeans to run under JDK 16 and restart NetBeans, .

    • Finally, select File > New Project... > C/C++ > C/C++ Application to verify that you can create a trivial C++ application and run it under JDK 16:

      CPPrunsOn124

    Notes:

    • See How do you enable C++17 in Netbeans? if you want to use C++ 17.
    • Note that NetBeans does not currently officially support C++, based on this comment in a NetBeans Bug Report NETBEANS-5501 :

      At the moment, NetBeans doesn't support C/C++, the plugins you were/are using from 8.2 are not really officially supported, though work on this is ongoing here, with an end goal to having it officially part of NetBeans, though that will take a while