Unknown Java error: Warning: Unable to load Java Runtime Environment

0

I am getting the following error dialogue when I want to run a program. The program has previously worked and it is giving this error all of a sudden:

Warning: Unable to load Java Runtime Environment: C:\....\jvm.dll is not a valid Win32 application

I am running a 64 bit Windows 7 system and have the latest 64bit and 32bit Java versions installed. I have already tried to reinstall then to no avail.

Any suggestions?

Jonny

Posted 2014-11-26T09:42:31.177

Reputation: 201

Answers

1

It sounds like the program (matlab) is a 64bit version and is using the 32bit JRE (Java Runtime Environment).

This means that the MATLAB_JAVA environment variable is pointig to the wrong JRE path or is not set.

HINT: You can set or edit an environment variable by following these instructions (but use the values in this answer post): http://www.nextofwindows.com/how-to-addedit-environment-variables-in-windows-7/

In the section "System variables" please modifiy or add the envirionment variable with the

 - variable name: MATLAB_JAVA
 - variable value: <use the path to your JRE>

For the path to your JRE check if one of them is available:

 - C:\Program Files\Java\jre8
 - C:\Program Files\Java\jre7
 - resp. C:\Program Files\Java\jre<number>

HINT: For 64bit do not use the C:\Program Files (x86)\Java\jre<number> path because this is the default 32bit path.

Save it and you should be good to go.

Mario Neubauer

Posted 2014-11-26T09:42:31.177

Reputation: 1 050

1Thank you. The program is MATLAB, and I first installed the updates automatically and when that didn't work I downloaded the offline installers and installed both the 32bit and 64bit versions via them. – Jonny – 2014-11-26T10:36:08.937

Please open a command-prompt (Windows+R), type echo %MATLAB_JAVA% into it and post the output as comment here. It will show us which version of the JRE Matlab is using. – Mario Neubauer – 2014-11-26T10:54:12.420

When I do that I simply get the same output as what I typed in, without the 'echo': %MATLAB_JAVA% – Jonny – 2014-11-26T11:12:37.763

This means that the MATLAB_JAVA environment variable is not set. You can set an environment variable by following these instructions (but use the values in this comment): http://www.nextofwindows.com/how-to-addedit-environment-variables-in-windows-7/ In the section "System variables" please add the variable name "MATLAB_JAVA". As variable value use the path to your jre. Check if one of them is available: C:\Program Files\Java\jre8 or C:\Program Files\Java\jre7 on your system and use the one available.Now try to start Matlab. Tell me if you more detailed instructions.

– Mario Neubauer – 2014-11-26T11:44:21.423

You are welcome! I will edit my answer post in order to show the complete solution at once. – Mario Neubauer – 2014-11-26T12:02:35.070

Mario, you might not perhaps be able to help me with this question?: http://superuser.com/questions/843968/anaconda-distribution-python-error-databaseerror-database-disk-image-is-malfor

– Jonny – 2014-11-26T16:44:25.487