WordRider Home
Welcome! Log In Create A New Profile

Advanced

portable java (windows) - new script

Posted by ra 
ra
portable java (windows) - new script
August 28, 2010 07:19PM
This is an updated version of my previous batch script, which was listed in [wordrider.net].

The version here fixes all known bugs and quirks.
I tested it with FRD 0.85alpha2 on Win 2003 Server only, I think it should work on XP and later just fine.
It should also work with FRD 0.83u1 (check line 45, "goto OK", if you run FRD 0.83u1).

This is a CMD.exe batch script that allows you to run FreeRapid using portableapps.com's portable Java, so FRD becomes fully portable even on computers where Java isn't normally installed. This script NEEDS portable Java. Instructions are included inside the script.

@echo off
rem This script runs FreeRapid using the Portableapps.com portable Sun JVM
rem Credits: JavaPortableLauncher.nsi
rem Thanks: Vity, author of FreeRapid; Angelo-Xavier, for comments 
rem Script last update: 20100805

rem MINIMUM REQUIRED versions: FreeRapid 0.83u1, Portable Java 1.6

rem 1. Download the latest portable Java update from
rem    [downloads.sourceforge.net] and install it in your portable
rem    application folder, say x:\port. So Java ends up in x:\port\Common Files\Java
rem 2. unzip FRD in x:\port, so frd.exe ends up in x:\port\FreeRapid\
rem 3. create folder x:\port\FreeRapid\tools\portablejava
rem 4. Copy the batch file below in x:\port\FreeRapid\tools\portablejava\runportable.cmd
rem 5. Double-click runportable.cmd to start FRD.

setlocal

title %~n0
color f2
cls

pushd "%~dp0"
set thisScriptPath=%CD%

pushd ..\..
set FreeRapidPath=%CD%
popd
set jarpath=%FreeRapidPath%\frd.jar
if not exist "%jarpath%" echo FRD not found && pause && goto ERROR

rem portableapps.com standard folder structure assumed
set JAVA_HOME=%FreeRapidPath%\..\CommonFiles\Java
if not exist "%JAVA_HOME%" echo JVM not found && pause && goto ERROR

pushd "%JAVA_HOME%" & rem to rid path of intermediate ..\
set JAVA_HOME=%CD%
popd

set CLASSPATH=.
set APPDATA=%FreeRapidPath%
cd "%APPDATA%"
start "" "%JAVA_HOME%\bin\javaw.exe" "-DexePath=%thisScriptPath%" -jar "%jarpath%" --portable %*

goto OK & rem to bypass REMINDER for versions higher than 0.83u1
echo =================================================================
echo REMINDER: do not let FreeRider auto-restart after plugin updates.
echo Just close it and restart it again with %~n0.
echo note: FreeRapid versions higher than 0.83u1 don't need a restart
echo after plugin updates, so you may comment out this reminder. 
echo =================================================================
pause
goto OK

:ERROR
set status=1

:OK
popd
exit %status%
endlocal & rem NOTREACHED
Sorry, only registered users may post in this forum.

Click here to login