How to fix error while installing NetBeans? - java

I have installed Java and am trying to install NetBeans 11.3 on my Windows 10 but after I ran the exe. installer, an error message popped up:
An unexpected exception happened in thread main
java.lang.NoClassDefFoundError java/util/jar/Pack200

NetBeans have problems with the jdk-14, because I suppose that you have install the jdk-14 so uninstall it and try it with the jdk-13.0.2.

Sorry, but in my opinion is to install an old version from Java no solution, just because it works. When someone has problems with his Firewall, simply disable the Firewall would also be no solution.
https://www.java.com/en/download/faq/other_jreversions.xml
We highly recommend users remove all older versions of Java from your
system. Keeping old and unsupported versions of Java on your system
presents a serious security risk. Removing older versions of Java from
your system ensures that Java applications will run with the most
up-to-date security and performance improvements on your system.
The "real" solution would be a reprogramming of the NetBeans installer.
This used function was suggested for deprecated on 2018-04-04, which was done on 2018-08-23.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8200752
The removal was suggested on 2019-10-08, which was done on 2019-12-18.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232022
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232022
We assume that developers who rely on Pack200 have had enough notice about its proposed removal to make alternative arrangements. … We assume that developers who use pack200 to shrink application JARs can switch to either the jlink tool or the jpackage tool to create application-specific runtimes with an optimized form factor.
edit: I solved it this way.
uninstalled JDK 14
installed JDK 13.0.2
installed Apache NetBeans
installed JDK 14
open C:\Program Files\NetBeans\netbeans\etc\netbeans.conf and changed path to JDK
uninstalled JDK 13.0.2
Now NetBeans runs with the JDK 14.

Yes, I got it working as follows from cmd, when referring to older version:
Apache-NetBeans-11.3-bin-windows-x64.exe --javahome "C:\Program Files\Java\jdk-12.0.2"

The https://netbeans.apache.org/download/nb113/nb113.html site now has this
memo:
The installers will not run under JDK 14 because usage is made of the Pack200 Tools and API, for packing and unpacking, which is removed in JDK 14, see JEP 367.

If several JDK versions are installed, then you need to define the environment variable "JAVA_HOME" where to set the path to JDK-12.
Details are described here. (Only in Russian)

An alternate way to Andy's.
(Windows)
1) Right click on "Apache-NetBeans-11.3-bin-windows-x64" installer and select "Create shortcut".
2) Right click on the created shortcut and select "Properties".
3) In the "target" textbox, add your under 14 JDK version path at the end, here is how mine looks like:
C:\Users\userfoldername\Desktop\Apache-NetBeans-11.3-bin-windows-x64.exe --javahome "C:\Program Files\Java\jdk-13"
4) Press Ok when done, double-click on the shortcut and it should install fine now.

Switching to openJDK 12 worked for me too. But instead of uninstalling JDKs or manually changing the env, I use Sdkman.io which works like Node version manager if you have used that. It manages your JDKS for you and offers downloads of different versions (Open, Zulu, Graals) and will switch between them with with just a quick command.

I found a nice solution in 3 steps:
check all versions of the JDK path in Environment variables, if there is an outdated path please remove it and keep the latest version of the Java JDK bin path.
after the second step, please uninstall the Netbeans and re-install the latest version.
Netbeans will found the latest JDK path in case it was jdk14 and choose JDK latest version path for NetBeans.
solved

Just install JRE from oracle. Everthing will run fine. I have the same issue

Related

Apache NetBeans IDE 12.0 cannot create new java application

I installed Java NetBeans IDE 12.0 and JDk-16. When I try to create a project using Java With Ant, it get stuck like in the screenshot. When I cancel it, it creates the file but no code in it i.e., no main method is created. Just a blank file.
Does anyone know how to solve this?
From the NetBeans documentation for "Deployment Platforms" for NetBeans 12.0:
Apache NetBeans 12.0 runs on the JDK LTS releases 8 and 11, as well as
on JDK 14, i.e., the current JDK release at the time of this NetBeans
release.
NetBeans may work (or appear to work) with newer JDK releases that are not officially supported such as JDK 16, but you run the risk of hitting unexpected problems.
So if you don't need any Java features released after JDK 14, download and install JDK 14, and add it as a Java platform in NetBeans, using Tools > Java Platforms > Add Platform.... You don't need to uninstall JDK 16.
However, if you really need JDK 16 features then use a different IDE. The latest release of Eclipse, 2021-03, explicitly supports JDK 16.
I had the same problem and was able to solve it in windows by following the steps below:
Uninstall Netbeans 12.4. Make sure to delete all the cache files
(Drive:\users\user\AppData\Roaming\Netbeans and
Drive:\users\user\AppData\Local\Netbeans) (Windows)
Check your JDK 16 directory (no JRE) and environment variables JAVA_HOME, CLASSPATH and PATH.
Install Netbeans 12.4
Create new project and check that you select Download and activate nb-javac.
For me it helped using NetBeans version 12.5 and the JDK 14. After that everything was running smooth.
I had the same problem and upgrading to version 12.5 worked for me.

JDK and JRE version confusion

I've been working with Java for a bit now and the JDK/JRE version has given me quite a bit of trouble lately. I am developing using the Intellij IDEA IDE and it of course uses the latest version of the JDK, 14. However when I attempt to execute software compiled with JDK 14 outside the IDE, I get an error that the JRE isn't new enough to run this software. So I updated Java on my computer and another machine and attempt to run again without any success. After some digging, I tweaked my machine to use the JRE included in the JDK 14 which is compatible.
However it is kind of odd that I had to do that, one would think that the latest version of java should of been enough to run applications made with the latest version of the JDK (14). Right now Java is version 8 build 251 and says there is no newer update available. If JDK 14 is out for a while now, why would they not update the version of Java they ship?
The problem is partially solved, as only the machine I am using for development is capable of executing the created applications. Other people I've sent them to have been unable to run them, despite having the latest version of java. Also it is a pain to get the latest JDK, especially when having limited experience on how to get rid of old versions, change path point to the latest version, get the right package (open/oracle JDK) and do that for windows and several distrubutions of linux. What is going on? Did I get Java from the wrong place and everyone else as well? Why are oracle doing this and why are there no java updates since clearly there exists a newer version?
Starting with Java-11, separate JRE does not exist anymore. In other words, if you are using Java-11 or above, you should care about JDK only.
You should uninstall JRE-8 from your machine and make sure your JDK-14 bin folder in the PATH variable. Some application even requires JAVA_HOME to work and therefore you should make sure that your system has an environment variable called JAVA_HOME and its value set to the root folder of JDK-14 (i.e. one level above your JDK bin).
Q: What should my clients do to run my application compiled on JDK-14?
Ans: Your clients must install JDK-14. Also, check this thread for some alternatives.
You're confusing how IntelliJ or JDK are used on the OS. IntelliJ, now, often comes with its JDK binaries (but even this can be configured, IntelliJ can be configured to use any JDK/JRE build you'll provide to it); however, if you run your Java application out of IntelliJ, most likely you're using Java installed locally on your OS, which might be referenced via your JAVA_HOME environment variable.
I'd suggest to:
Check java -version in your shell (and hence you'll see what JVM instance your OS spins up when you run a Java application);
Check where java (on Windows, or which - on Linux) in your shell, to see all the Java binaries available on your OS.
Try to uninstall Java SE Development Kit and Java JRE(if you have both in your machine) and reinstall both again, JDK and JRE both, I am sharing my google drive link where you can find the latest version of both JDK and JRE and when you are done installing, add there bin folder path in the Environment Variables of your machine.

Can I have two versions of the JDK on my computer?

I'm trying to set the IntelliJ IDEA JDK to version 1.8 (because it's the latest). When I navigate to System/Library/Frameworks/JavaVM.framework IntelliJ IDEA shows 1.6. When I type java -version it shows 1.8. I found that command under "Finding default JDK on OSX" https://www.java.com/en/download/help/version_manual.xml
I'm confused what versions of the JDK I have... and where they are located. Appreciate any help.
Yes, you can. You have JDK 1.6 and 1.8 installed on your computer. According to the Jetbrains website, all their products require Apple JDK 1.6 to be installed in order to run on Mac.
To make IntelliJ IDEA use JDK 1.8, you will need to edit /Applications/<Product>.app/Contents/Info.plist file and change JVMVersion from 1.6* to 1.8* :
<key>JVMVersion</key>
<string>1.8*</string>
To start off java will usually uninstall any version of the JDK when you get an update. Secondly if you want to check to see what version you are running I would go into what ever you are using to program and see what version you are compiling under (For example netbeans or eclipse). If it says 1.8 that is what you are running and same for 1.6. If this is really becoming a super big problem all you have to is uninstall java then re install and it should fix it.
You can have many different versions of Java on your system. In general Java depends on environment variables and the PATH environment variable. Some programs and tools look for tool specific environment variables to allow you to use a specific version of Java for that particular tool.
In the case of IntellJ the link that Eddie B posted in his comment explains how IntellJ determines which "installation" of Java it should use.

Fedora updates make Eclipse forget Java

(Not sure if this is an okay place to ask, but i'll try). After installing some updates in Fedora 16, Eclipse no longer knows how to use Java files. It can't make them, or compile them, or format the syntax. It's just eclipse without any Java whatsoever. I checked the yum.log and it installed about 6 eclipse updates and 2 java updates. A solution I found on the internet was to delete .eclipse and have eclipse regenerate it, but that didn't fix anything. Anyone know what's up?
The problem is documented here:
http://lists.fedoraproject.org/pipermail/devel/2012-January/161092.html
and this is the bug:
https://bugzilla.redhat.com/show_bug.cgi?id=760454
Basically, we were caught between a rock and a hard place and had to break a packaging loop so this broke people's existing installations. Move ~/.eclipse and restart Eclipse and you should be fine.
$ mv ~/.eclipse{,.bakBug760454}
I have faced a similar problem, it would be best in my opinion to remove every package for java and eclipse all together. You can find installed packages with:
sudo rpm -qa | grep keyword
where keyword would be for example 'jre', 'jdk' or 'eclipse'.
Once you find the packages you don't want, remove them with
sudo yum remove packagename
Then I would recommend you to skip default jdk available for linux and install the one provided from the Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/index.html
I have installed version 6 myself as I had some maven problems (m2eclipse) with Java 7.
Download the rpm, install it and set you path to java in .bashrc file.
Check all your installed jre/jdk with
sudo alternatives --config java
or
sudo alternatives --config javac
and set the apropriate option if necessary.
Next, go to the eclipse website and download the latest stable release of eclipse and you should be fine. You can integrate it with the desktop as well so you won't have to start it from the command line every time.
Check all of the available eclipse* packages. "Eclipse" itself is just a plug-in platform with a lot of UI components, it's not a Java IDE unless you also install those plug-ins. It's possible that the packaging was changed in a way that the Java plug-ins were no longer included in the packages you have installed after the upgrade completed.

Where can I set the JRE/JDK which is used to run Netbeans besides the command line?

First of all, I know about the command line parameter, but I don't want to use it because I want to learn, not just get it done, so...
Where can I set the JRE/JDK which is used to run Netbeans?
A little background:
I installed JDK 1.6_10 (The system is Windows Vista Business 64)
I installed Netbeans 6.5
After a few weeks I uninstalled Netbeans 6.5 (some problems which I hope to solve by a reinstall)
I also uninstalled JDK 1.6_10 and installed 1.6_11 instead.
I reinstalled Netbeans 6.5
Now I cannot start Netbeans because it insists of using the old JDK. (Trying to use the default version doesn't work either. JAVA_HOME is set to 1.6_11)
Try setting netbeans_jdkhome in {NetBeans directory}/etc/netbeans.conf.
# Default location of JDK, can be overridden by using --jdkhome :
netbeans_jdkhome="..." # (omitted path, as I have Java in a non-standard location)
Based on the voted answer, here's what I did on my Mac and it worked...
(download JDK from Oracle)
$ vi /Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
[...]
#netbeans_jdkhome="/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/bin/jre"
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/"

Categories

Resources