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?

1 Answer 1

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.

6
  • 1
    Thank 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
    Nov 26, 2014 at 10:36
  • 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. Nov 26, 2014 at 10:54
  • When I do that I simply get the same output as what I typed in, without the 'echo': %MATLAB_JAVA%
    – Jonny
    Nov 26, 2014 at 11:12
  • 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): nextofwindows.com/… 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. Nov 26, 2014 at 11:44
  • You are welcome! I will edit my answer post in order to show the complete solution at once. Nov 26, 2014 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.