Tuesday, January 22, 2013

How to resolve 'Could not find the required version of the Java(TM) 2 Runtime Environment'?

I was encountering the 'Could not find the required version of the Java(TM) 2 Runtime Environment' error when I was trying to install JDK 64-bit on my 64-bit Windows 7 machine.

The reason for throwing such error is that JDK installer is written in Java, therefore you need to have JRE installed. I assume that this is a bug in the Java installer somewhat, because after installing JDK EE, you will have a JRE inside that as well, so you end up having two JREs. Surprisingly, if you install JRE 64-bit and set your %JAVA_HOME% and path variables, you will still see that issue remains the same.

Solution is that you should install JRE 32-bit instead of 64 bit version of JRE. If you install it, then you can install JDK EE or/and Glassfish via the installer. This might sound strange but it is true!

8 comments:

  1. Nice answer totally saved my day!

    ReplyDelete
  2. Hello Amir
    I had the same problem installing Java EE SDK
    I solved it running an Administrator console window and typing
    java_ee_sdk-7-jdk7-windows-x64-ml.exe -j "%java_home%"
    Think the -j option and the quotes for the java_home variable were the problem because of the space in "program files" directory name
    As an extra step I copied the installer file to the C partition... but I don't think it is necessary.
    Hope this helps on future installations

    Cheers!

    ReplyDelete
    Replies
    1. Thanks. Specifying a path to an existing 64-bit JRE installation directory to the jdk EE installer does the trick. You don't need to install a 32-bit JRE.

      Delete
  3. It did trick for me, i installed a 32 bit JRE and my installation happen, otherwise it was asking for providing the JRE and from command line after providing the JRE the installation screen flashed and hide. Your trick did work for me. (I was trying to install eh Glassfish server)

    Regards
    Mannan

    ReplyDelete
    Replies
    1. Thanks. I was trying to install Glassfish. It worked for me

      Delete