Page 2 of 2

Re: Is a Portable Version Possible?

PostPosted: 16 Jan 2017, 02:13
by pufthemajicdragon
Wow... so much nonsense in this thread... And look at me, resurrecting it from the dead.

1. There are many many reasons why a person would want to make a portable app. Ours is not to question their motives, but simply to answer whether or not it is possible.

2. There are plenty of ways to compile a standalone executable using Java that will not require the JRE in any form. Any of your commercial compilers can do it by default. Simply put, the JDK is mostly just a collection of classes and includes that you can reference in your program but which the JDK compiler does not compile into your program. These are included in the JRE. But there's no reason that they can't be compiled into your program to make a fully functional standalone exe, it just takes longer to compile and makes for a bigger program.

3. Java is perhaps the worst language ever written. Partly because the JRE is one half step above malware, but mostly because the language is just so easy to learn that a whole lot of amateurs pick it up and write immature apps that do really stupid things (like saving data to the user's AppData folder without providing a proper uninstaller).

4. JPortable exists and supposedly works with 3rd party apps. So making a portable Forge is theoretically possible and has apparently even been done. But no instructions exist for anyone trying to figure out the process themselves.

So the question from the OP remains ( 7 years later...) - Is it possible to make a portable version of Forge and how is it done?

I've had no success getting the Windows download of Forge to run using JPortable Java 8 or JPortable Java 7. I've tried just dragging and dropping forge-gui-desktop-1.5.58-jar... onto Java.exe and Javaw.exe, as well as running "java -Xmx1024m -jar forge-gui-desktop-1.5.58-jar-with-dependencies.jar" from the command line within the JPortable folder. In each case literally nothing happens - I don't even get a blip of Java.exe on my task manager.
Would using a portable Java require compiling a custom binary of Forge?
This is the full collection of JPortable downloads.

How about we just make a request that future versions of Forge include a line that searches for a local path to Java (such as .\res\java\bin) when it checks for the JRE?

Re: Is a Portable Version Possible?

PostPosted: 16 Jan 2017, 14:25
by Huggybaby
Thanks for the reply. :) This is why we don't lock old threads, because sometimes they deserve a resurrection.

Re: Is a Portable Version Possible?

PostPosted: 19 Jan 2017, 13:07
by Agetian
For what it's worth, when I was still using Windows a few years ago I was running a custom fully portable version of Forge that I could run off of a flash drive or basically anything at all without being locked to the need of pre-installed Java on that machine.

What I did was I created a folder in the Forge directory called "java" and I copied the Java folder structure there (the "bin" and "lib" folders, in particular). Note that I used standard Java ( 7 or 8 ), not the JPortable version (with which I had no success either).

Then I wrote a simple script (a "batch file" in Windows terms, I guess) that started Forge using Java from that said folder. It's a one-liner:

Code: Select all
@java7\bin\java.exe -Xmx2048m -jar forge-svn.jar
(I used the custom name for the .jar, "forge-svn.jar", but it can be changed to anything, for example, to match the Forge .jar name as used in beta releases). Memory allocation can be tweaked as necessary, too (2048M seems a good balance though unless you're planning to run it on machines with less than 3 GB RAM or so).

To make Forge truly portable, I also edited forge.profile.properties in such as way that it pointed to the folders inside my Forge installation instead of to the default AppData folders (or wherever it was that Forge tried to store stuff by default on Windows). This is easy to do, for starters you can just set userDir and cacheDir to some folders relative to the current path, e.g.:

Code: Select all
userDir=profile
cacheDir=cache
Then, just copy the relevant profile and cache files to those folders and you're done. Voila, one portable Forge ready to be played wherever needed. :)

- Agetian

Re: Is a Portable Version Possible?

PostPosted: 20 Jan 2017, 21:45
by Fizanko
Very interesting, i had no idea it was possible to have a fully portable of Forge as i thought java was required to be installed on the computer for any portable program requiring java to actually work.
I had already my forge properties pointing to a folder inside of Forge for my own ease, but the java thing is new to me.

Thanks Agetian, very usefull information.

Re: Is a Portable Version Possible?

PostPosted: 21 Jan 2017, 04:26
by Agetian
Glad to help! :) Yeah, I was surprised too when I first tried it, but it ended up working flawlessly, at least with Forge :)

- Agetian