PDA

View Full Version : Directly running JRE from a USB-stick



vbtricks
June 21st, 2008, 09:17 AM
Salut,

in order to get my Java application running on any Linux pc without having to install the JRE, I'm trying to integrate the JRE into the USB-stick.

I therefore downloaded the self-extracting file from java.com and extracted it. The first try starting it directly using


cd /path/to/java
./java -jar /some/other/path/app.jar

resulted in an error message


./java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

So I added the direct path of the libjli.so to LD_LIBRARY_PATH and tried again. So I got another error message


Error: could not find libjava.so
Error: could not find Java 2 Runtime Environment.

As this error message looks different to the first one, I doubted that adding the direct path of libjava.so to LD_LIBRARY_PATH would work and trying to confirmed by suspicion.

Did any of you succeed getting the JRE to run without install, and if how?


Thanks in advance,

Stefan

xlinuks
June 21st, 2008, 09:45 AM
I haven't tried yet (but I guess I'll try soon), I would suggest creating a softlink to the java executable and putting it into the folder where the .jar app lies. Then do "./java app.jar" and see whether this works. Haven't tested but might work.

xlinuks
June 21st, 2008, 10:23 AM
Well I actually tried and succeeded.
I tested it on a computer that doesn't have Java installed.
I created a symbolic link in the dir where the .jar app lies and created an .sh script to runs that file. The contents of the sh file is this (my test java app is called Signer.jar:


#!/bin/sh

./java -jar Signer.jar

The screenshot is attached.

PS: you will need to format the USB stick to Ext3 since Fat32 doesn't support symbolic links.

vbtricks
June 21st, 2008, 10:55 AM
Thanks, works perfectly.

xlinuks
June 21st, 2008, 12:22 PM
You're welcome :)

aMeR1CaN_aUsSie
June 23rd, 2008, 07:35 AM
I found a simpler solution:


ln -s / /cow

For more information go to my tutorial here:

http://ubuntuforums.org/showthread.php?t=829866

Enjoy.

aMeR1CaN_aUsSiE

vbtricks
June 23rd, 2008, 07:41 AM
Well, in fact it's even easier. My problem was that I switched to the directory of the java and then called

./java -jar /complete/path/to/my.jar
Instead I only needed to switch to the directory of the .jar file and the call

relative/path/to/java -jar my.jar

An85Zk9tc8rfjV8i
May 13th, 2009, 01:34 PM
You're welcome :)
__________________
62°23′30″N 145°09′0″W
ёёмаёё..


:popcorn:

High Frequency Active Auroral Research Program - Wikipedia (http://en.wikipedia.org/wiki/High_Frequency_Active_Auroral_Research_Program)

GeoHack - High Frequency Active Auroral Research Program (http://stable.toolserver.org/geohack/geohack.php?pagename=High_Frequency_Active_Auroral _Research_Program&params=62_23_30_N_145_09_03_W_)

:popcorn: