Solved

a script for loading a library and running java

Posted on 2004-08-31
5
246 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
Comment Utility
#!/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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now