Solved

a script for loading a library and running java

Posted on 2004-08-31
5
249 Views
Last Modified: 2010-04-21
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
0
Comment
Question by:hapciu
  • 3
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 50 total points
ID: 11941745
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/diretory
java -jar myjar.jar


where /path/to/directory is the directory where libMyLibrary.so is located
then make this script executable
chmod a+x myScript

0
 

Author Comment

by:hapciu
ID: 11947562
and export should work for all shells ?
thanks for the trick with making the script executable ... i wouldn't have found it
0
 
LVL 18

Expert Comment

by:liddler
ID: 11947950
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
0
 

Author Comment

by:hapciu
ID: 11948262
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 ?
0
 
LVL 18

Expert Comment

by:liddler
ID: 11949380
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
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
understanding folder structure inside an rpm 2 74
understanding an rpm spec file 5 66
automating commands in linux on start up 2 47
Use Powershell script to ftp 10 119
Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question