Solved

a script for loading a library and running java

Posted on 2004-08-31
5
247 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Centos Boot Error 42 115
idM Identity Management in Red Hat 6 - setting up 9 263
Need bundled ATFTP tool for use with ESXi 4 84
add some character at the end of line in vi 7 61
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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

22 Experts available now in Live!

Get 1:1 Help Now