Minecraft Forge Setting up Java for Modding

Background

Java is sometimes difficult to set up properly, because there are run-time environments (JRE) and Java development kits (JDK) and furthermore you need the right versions and need to set up proper Windows environment variable paths.

Steps To Set Up Java For Modding

    1. Download an appropriate JDK (not JRE!). At time of writing the Kit 7 was most compatible with modding, downloadable from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html.  Make sure you choose the version appropriate to your computer (in my case Windows x64).
    2. Install the JDK following the instructions.
    3. Ensure the Windows path variables are set up.  You probably need to create a JAVA_HOME user variable, as follows


    Find JDK Installation Directory
    First you need to know the installation path for the Java Development Kit.
    Open the default installation path for the Java Development Kit
    C:\Program Files\Java
    There should be a subdirectory like (may be slightly different version)
    C:\Program Files\Java\jdk1.8.0_231
    Set the JAVA_HOME Variable
    Once you have the JDK installation path:
      1. Right-click the My PC (or My Computer) icon onyour desktop or in the File Explorer and select Properties.
      2. Click the Advanced System Settings tab. 
      3. Click the Environment Variables button. 
      4. Under User Variables section, click New.
      5. Enter the variable name as JAVA_HOME.
      6. Enter the variable value as the installation path for the Java Development Kit.
      7. Click OK.
    4. Add to the "Path" system variable by:

      1. Under System Variables section, select Path, click Edit.
      2. Click new and put in the same value as you did before but add "\bin" to the end.
      3. Click OK.

    5 comments:

    1. what do u mean "add" to the Path variable? i have my Path set up as a user variable, does that matter?

      ReplyDelete
      Replies
      1. Well Windows should already have an Environnment Variable called PATH which you can add to (using semicolon to separate from what is already there). I think it is also true that you can set up your development environment to look for the path instead but I tend to do it right in the Windows Environment Variables.

        Delete
    2. I dont't really understand statement #4. What does "adding to the path variable" mean?

      ReplyDelete
    3. Well. I did everything as it is. And every time I import the build.gradle file to IntelliJ, this error keeps popping up. It says that the compiler has found an error in the variable and should be fixed.

      ReplyDelete