Skip to main content

Java Portable (?) on windows

I've tried several Java application on Microsoft Windows but sometimes JRE wasn't available.
I've put up a really simple batch script to load any java application, even from a pendrive, without installing the whole JRE.
Before anything download and install java runtime enviroment (JRE) from the sun website.
You can also download directly the JDK (Java Development Kit) and use this script for the java development. You can add several other development applications that can be launched independently from the computer that you are using (on windows).
After Installing JAVA (this should be pretty easy to do ... ->double click on the executable file, click on forward, forward, end ... ) go to the program files path %programfiles% (ex. c:\program files | c:\programmi | c:\programas ) then in JAVA\jreX (ex. c:\program files\JAVA\jre6 ).
Copy the "lib" and "bin" folders to the folder "JAVA" (just create it) inside the folder from where you want to run your application. (ex. F:\myjavaapplication\JAVA ).


Copy those few lines within a text file and rename it with the .bat extension (the .cmd extension is good too).

@echo off
for /F "delims=" %%I in ("%~dp0") do @set set_path_root=%%~fI
set path=%set_path_root%\JAVA\bin;%set_path_root%\JAVA\lib;%PATH%
set HOME=%set_path_root%
REM "%set_path_root%\JAVA\bin\java.exe" -jar WebScarab-ng-0.0.1.one-jar.jar database\webscarab
start /B "%set_path_root%\JAVA\bin\javaw.exe -jar" WebScarab-ng-0.0.1.one-jar.jar database\webscarab
exit

This example is for webscarab ng (next generation) that starts a GUI (.... if you can't understand ... it's an application with the "windows" 8) ).


For a console application or if you want to see warnings/errors of your application with the GUI you can use
"%set_path_root%\JAVA\bin\java.exe" -jar WebScarab-ng-0.0.1.one-jar.jar database\webscarab

The difference between java.exe and javaw.exe is that the first shows the console. (I'm not aware of other differences .... sorry).

Put your JAVA folder outside of your application path if you want to have java available for more than one application on your pendrive.
Remember to change the relative paths ( ex. subfolder/ | ../anotherfolder )in your batch files. Avoid the use of absolute paths ( ex. c:\afolder\anotherfolder | \afolder\anotherfolder ).


That's all.

Comments

Popular posts from this blog

Moodle 3.8.1+ - path leak via errors in several files

Moodle 3.8.1+ ----------------------------------------------- File: admin/mailout-debugger.php #!/usr/bin/php Notice : Disabled. in \admin\mailout-debugger.php on line 73 File: admin/settings/appearance.php Notice : Undefined variable: hassiteconfig in \admin\settings\appearance.php on line 10 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\appearance.php:10 Stack trace: #0 {main} thrown in \admin\settings\appearance.php on line 10 File: admin/settings/badges.php Notice : Undefined variable: hassiteconfig in \admin\settings\badges.php on line 30 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\badges.php:30 Stack trace: #0 {main} thrown in \admin\settings\badges.php on line 30 File: admin/settings/courses.php Notice : Undefined variable: hassiteconfig in \admin\settings\courses.php on line 32 Fatal error : Uncaught Error: Call to undefined function

2022 - Remove (the too many) Ads from Memu launcher

Simple method Download from pureapk "MEmu Launcher2" ex: MEmu Launcher2_v6.0.9_apkpure.com Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar) Longer method Install "Export Apk" Export the memu launcher2  Install purify https://github.com/echo-devim/purify/raw/master/Purify.apk use purify with the exported memu launcher 2 Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar)