SiK
SiK

Reputation: 89

How to solve "error during initialization of VM" (Java)?

I've a 64bit Windows 7 OS, I installed Java creating a new Enviroment Variable called PATH and wrote the path of the bin folder. When I write javac it works fine, but when I launch the program it says

Error occurred during initialization of vm java.nio.charset.unsupportedcharsetexception

Upvotes: 2

Views: 2978

Answers (2)

newur
newur

Reputation: 520

I just run into the same error today, after switching to a new workspace with Eclipse.

This is what happened: Eclipse decided to choose the folder "jre7" in my Java dir as default JRE (which produces the mentioned error) and not providing an alternative selection. (Normally I use "jdk1.7.x.x" in the Java dir, which obviously contains also a JRE...)

Simple fix: Going through Eclipse Window -> Preferences -> Java -> Installed JREs remove the wrong entry and Add the path to the correct folder. Unfortunately, if there are any projects already importated or servers configured, Eclipse does not update them to the new Standard VM, so this has to be done by hand.

Not sure if this setup applies to your concrete problem, but one can run very easily into this error. Once you have a not working (and forgotten) JRE installed which is automatically selected by Eclipse.

Upvotes: 0

ConcurrentHashMap
ConcurrentHashMap

Reputation: 5084

The mentioned exception

Error occurred during initialization of vm java.nio.charset.unsupportedcharsetexception

may be thrown when using wrong character encoding (as mentioned here). But it might also be caused by your current Java installation, having installed a 32bit version on a 64bit platform.

Please make sure, you're using the right JRE (64bit) with the right JDK version. Make sure, you are using the right PATH, if there are different installations beside. If the target platforms differ, Java might throw this error. So the solution in this case: Remove all previous installed JRE and JDK and reinstall a clean JDK 64bit (normally including JRE).

Upvotes: 1

Related Questions