4

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

Shervan_d
  • 61
  • 1
  • 5

2 Answers2

7

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

skomisa
  • 16,436
  • 7
  • 61
  • 102
  • 1
    I run NetBeans 12.4 on JDK 16 and it simply asked me for the location of `unpack200.exe` when trying to install the C++ plugin from the NetBeans 8.2 portal. – Martin Jun 24 '21 at 13:51
  • @Martin OK. Perhaps NetBeans 12.4 was enhanced to detect the absence of unpack200 when installing the plugin. I will try to install using JDK 16, and update my answer as appropriate. – skomisa Jun 24 '21 at 14:58
  • @Martin I just tried your approach, but it didn't work for me on NB 12.4. After clicking the **Choose Unpack200...** button I selected the instance of it in JDK 11, but the plugin download hung, then terminated, when it was 99% complete (_"Timeout of loading remote API"_). I'll try again another time since perhaps I was just unlucky with the availability of the update center for the C/C++ plugin. Did this approach definitely work for you? – skomisa Jun 30 '21 at 03:36
  • This worked for me last week when I posted my first comment with the `unpack200.exe` from JDK 11 and today with the `unpack200.exe` from JDK 13 (I had to move the JDK 11 directory to get the window with the "choose `unpack200.exe`" button again, at my first attempt it just used the `unpack200.exe` I selected last time). Both times running on JDK 16 by setting `netbeans_jdkhome` in `NetBeans\etc\netbeans.conf`. – Martin Jun 30 '21 at 11:08
  • @Martin OK. If you post it as an answer I'll be happy to upvote it. That approach is superior to the one in my answer, and it should really be the accepted solution. But since it's not working for me I can't really update my answer. – skomisa Jun 30 '21 at 15:50
0

I was able to easily fix this by just going to Oracle's website and downloading the last version of the Java JDK to include unpack200.exe and then pointing the installer to the correct file - without installing the JDK.

You'll want version 13.0.2 (build 13.0.2+8) - openjdk-13.0.2_windows-x64_bin.zip - which can be found at https://jdk.java.net/archive/

Once the contents of the zip file you downloaded have been extracted, you can continue the install by clicking on the "Choose unpack200.." button located in the bottom left of the warning dialog box you posted. That will pop up a window allowing you to navigate to the extracted \openjdk-13.0.2_windows-x64_bin\jdk-13.0.2\bin directory so you can select the unpack200.exe file and complete the install.

S. Henson
  • 1
  • 1