Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

a script for loading a library and running java

Posted on 2004-08-31
5
Medium Priority
?
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 18

Accepted Solution

by:
liddler earned 150 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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 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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 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