Changing default Java Runtime Environment from 1.8 to 1.7

73,616

Solution 1

Try:

Remove JRE 8

  1. Go to Uninstall a Program in your computers Control Panel
  2. Uninstall JRE 8

Install JRE 7

  1. Download JRE 7
  2. Install JRE 7

Update your Computer's JAVA_HOME system variable

  1. Right Click on Computer in the start menu
  2. Select Properties in the Drop down
  3. Click on Advanced System Settings
  4. Click on Environmental Variable under the Advanced Tab
  5. Under System Variables click New
  6. For Variable Name: write "JAVA_HOME" without quotations
  7. For Variable Value: write your computers path to the new install of JRE 7
  8. Click Okay, then Click Okay Again
  9. Restart the computer

Hopefully that helps, it worked for my downgrade from Java 8 to Java 7

Solution 2

You have to add the java 7 folder into the Path. No need to reinstall.

Start-> type and open "Edit the System environmental Variables" -> envriornmental variables then locate the Path variable in the system variables.

check that in the Path variable you dont have java 8 location: C:\Program Files\Java\jre1.8.0_31\bin

but make sure its C:\Program Files\Java\jdk1.7.0_51\bin

Solution 3

It happens when there are two variable for PATH one for user environment variables and other for system environment variable. If one of them is pointing to java 1.8 and other pointing to java 1.7 which leads to an ambiguity. So creating a JAVA_HOME variable for both system and user and configuring this in PATH of user and system environment variables would resolve this issue.

Then javac -version or java -version in command line gives the version of java which is configured in JAVA_HOME.

The above approach solves the issue for me.

Share:
73,616

Related videos on Youtube

nc4pk
Author by

nc4pk

I am a sophomore studying Computer Engineering at North Carolina State University in Raleigh, North Carolina.

Updated on September 18, 2022

Comments

  • nc4pk
    nc4pk almost 2 years

    I'm currently trying to change the default JRE on my computer from 8 to 7.

    I was attempting to fix a glitch involving the game Minecraft by updating to the JRE8 beta build, but it seems like that installer was corrupted and stopped midway before crashing. Now, whenever I try to launch any Java related program, it keeps on pointing to JRE8 even though it's installed. I attempted to reinstall it but the launcher doesn't seem to launch anymore even after I redownloaded it and tried several other builds.

    I applied a temporary band-aid fix by either copying my JRE7 folder, pasting it, and renaming it to JRE8. Or I can also go into the registry and change the 1.8.0 registry (HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.8.0) to point to the JRE7 folder instead of the JRE8 folder. If none of these two "fixes" are applied, I get a Launch4j error when I attempt to launch anything Java related:

    enter image description here

    How can I fix this?

    • Rob
      Rob almost 11 years
      Add the content of your Launch4j error to the question.
    • Ramhound
      Ramhound almost 11 years
      Changing the registry seems like a valid solution without the crash message from the installer your question remains unclear
  • 4xy
    4xy over 8 years
    I already changed JAVA_HOME to 1.7 jdk, also PATH contains value derived from JAVA_HOME. In control panel Java applet I disabled 1.8 java jdk and jre and anyway java -version gives me 1.8.0_71
  • Aaron S
    Aaron S about 8 years
    Shouldn't changing JAVA_HOME be enough? Why the need to un-install JRE 8?
  • Burgi
    Burgi about 8 years
    Could you go into a little more detail on how the OP would go about setting these variables?
  • ChimneyImp
    ChimneyImp about 8 years
    For Windows 7, go to Control Panel\System and Security\System , click "Advanced System Settings" on the left, and click "Environment Variables." This shows you the PATH and JAVA_HOME variables. Other modern versions of Windows are similar.