It is currently 25 Aug 2025, 16:51
   
Text Size

HOW-TO: Run Forge portably with a custom Java version

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

HOW-TO: Run Forge portably with a custom Java version

Postby Agetian » 19 Nov 2012, 06:11

Did you ever want to...

1) Run Forge portably, even from a flash drive, and even on computers that do not have Java installed on them at all?
2) Upgrade to Java 7 but still be safe that you're running Forge with the Java 6 runtime while we are working on figuring out whether Forge is fully compatible with JRE 7 already or if is still needs some code base upgrades?

Well, actually, both are very simple to do and involve a rather simple procedure that is described here in this topic. This example is written for Microsoft Windows, but I'm quite sure that a similar shell script can be written under Linux or Mac OS X as well if necessary (though your personal experiences in this area, as well as advice, are all welcome!).

So, here's how you create a fully portable installation of Forge with its own, independent version of Java:

1) Install the Java Runtime Environment that you want to make portable (for instance, if you want to run Forge with Java 6u37, then install JRE 6u37 on your computer first).
2) In your Forge folder, create a new folder and call it "jre".
3) Copy all the Java Runtime Environment files from wherever you installed JRE into the "jre" folder you just created for Forge. You need to preserve the structure of folders, so that for the "jre" folder, you have a structure like this:
Code: Select all
jre/
....bin
....lib
....COPYRIGHT
....README.txt
....THIRDPARTYLICNSEREADME.txt
....Welcome.html
4) In your main Java folder, create a batch file and name it something like RunJavaPortably.bat or RunJavaPortably.cmd (both are for Windows). The exact file name is up to you, but the extension (in Windows) must be either .bat or .cmd. The text of the batch file should contain one command (this is for v1.3.1 of Forge):
Code: Select all
jre\bin\javaw.exe -Xmx1024m -jar forge-1.3.1-jar-with-dependencies.jar
IMPORTANT: depending on your version of Forge, you may need to specify a different file name of the .jar executable - for instance, version 1.3.0 of Forge uses the file name "forge-1.3.0-jar-with-dependencies.jar", SVN builds use their own naming scheme, etc.
IMPORTANT: the allocation of 1 GB memory for Forge seems to be enough (I've never had issues with that), but if you ever run into memory problems, you may want to allocate more memory for Forge; in that case, try specifying, for example, -Xmx1280m instead of -Xmx1024m as a parameter in the batch file. Personally I've never had a problem with allocating 1024MB. If you specify a parameter that is more than Java can allocate on your computer, it will fail to run, so it's recommended that you try the original -Xmx1024m parameter first before trying to increase it.
5) Save your batch file and launch it instead of launching Forge.exe. Enjoy your portable installation of Forge!

Once you make your Forge portable like that, it becomes independent of the main Java runtime installed on your PC. You can freely upgrade, for example, to Java 7, while still running Forge with the original Java 6 runtime that you copied into your "jre" folder. If you want to upgrade your Java runtime you're running with Forge, just delete the current contents of "jre" and copy the newer, updated version of JRE into it in the same way as described in step 3 above.

Enjoy!

- Agetian
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: HOW-TO: Run Forge portably with a custom Java version

Postby ozks » 05 Feb 2013, 06:41

works fine. thanks
now, i don't need java to play it
User avatar
ozks
 
Posts: 279
Joined: 24 May 2012, 22:49
Has thanked: 107 times
Been thanked: 23 times


Return to Forge

Who is online

Users browsing this forum: No registered users and 28 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 28 users online :: 0 registered, 0 hidden and 28 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 28 guests

Login Form