Use the vanilla Java runtime

Why

Ever since early 2015, the most up to date Minecraft: Java Edition launcher has come with a built-in version of Java. This means that it is no longer needed to be installed on the computer beyond the version built-in with Minecraft.
This is good, as having the latest Java version is good for running the game efficiently and securely - see the wiki’s comment on this topic. Additionally, Java is often fraught with security issues, so it is often safer not to have it available for any program to use.

Unfortunately, a lot of Minecraft tools - especially modded tools, require access to a Java runtime for installation - this is needed for forge and optifine - e.g the optifine installer requires Java to be present to install optifine - which is by far the easiest method of installation, but there is no obvious way to do this without installing Java to your computer.

How

There is a way to make use of the built-in Java runtime, which is documented below.
The subpoints laid out under each point are windows specific - laying out every step, and are only confirmed to work for windows 10.

  1. Find the folder where the Minecraft launcher is located.
  2. Open the Minecraft launcher.
  3. Right-click the icon on the taskbar
  4. Right-click on the Minecraft_staging text in the menu which comes up.
  5. Left click on properties Properties location
  6. Copy the contents of Start in to a new explorer window. E.g. C:\Users\<username>\Documents\Minecraft\Launcher
  7. Find the built-in Java executable.
  8. From the folder you found in 1., navigate to runtime\jre-x64\1.8.0_51\bin
  9. Ensure that the file java.exe is in this folder.
  10. Copy the link to the folder.
  11. Choose the folder that you want to run your installers from. (For me this is C:\Users\Levertion\Documents\Minecraft\Mod Installation).
  12. Create an executable file in this folder formed as follows:
    For windows, create a file called 'install.bat'
    For mac/Linux create the equivalent file type - not sure how - sorry.
    Then:
     Paste in the folder path you copied earlier, then add '/java.exe' - For Windows, this must be surrounded by quotation marks
     Add ' -jar ' to the end of the file.
    Eg: For me, it is:
    "C:\Users\Daniel McNab\Documents\Minecraft stuff\Launcher\runtime\jre-x64\1.8.0_51\bin\java.exe" -jar
    
  13. Running this:
  14. Download the mod installer
  15. Put it in the same folder as the script file.
  16. Then edit the script file so that the end of the file has the name of the installer file

Support

If you have any issues getting this to work, feel free to tweet me @LevertionMC with your issue - maybe use Pastebin to get around the limit.

Comments