Link to home
Start Free TrialLog in
Avatar of hapciu
hapciu

asked on

a script for loading a library and running java

Hi,
I have a java application (bundled in myjar.jar) that uses a native library (libMyLibrary.so).
I need a script that will do the following:

1. append to LD_LIBRARY_PATH the path to libMyLbrary.so (this is the same path as the one where the script will be located and run from, so actually append the path of the script). i understand this is done with "setenv" for tcsh and csh and with "export" for bash shell. i would like it to work for all shells.

2. execute the command java -jar myjar.jar (which will start my java app)

please help,
if this is easy, i'm sorry for bothering, but i'm a total beginner in Linux.
thanks
ASKER CERTIFIED SOLUTION
Avatar of liddler
liddler
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hapciu
hapciu

ASKER

and export should work for all shells ?
thanks for the trick with making the script executable ... i wouldn't have found it
The export will work because the first line of the scripts (#!/bin/bash) will run the script in bash regardless of the shell you use
Avatar of hapciu

ASKER

aha, ok thanks,
one more thing: i made the script executable with chmod a+x and i can run it from the console with  ./script.sh BUT when i click it in the desktop (or konqueror) it says "Can't find program script.sh"
what is this ?
Is the icon on the desktop a symbolic link? If so check it's properties and make suer it is linked to the absolute path of the script, like /home/my_dir/script.sh not just script.sh
If not I don't know I'm not a GUI user