Register
It is currently Mon Sep 22, 2014 4:11 am

Program execution


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Wed Nov 06, 2013 4:38 am   

Joined: Wed Nov 06, 2013 4:29 am
Posts: 2
Hey all,

I need help with my bash script. I have a bash script that runs a java application. Think of it like this:

Bash script locatin: /home/my_directory/bashie.sh
Java location: /home/my_directory/java_program/my_java.jar

My bash script:
java -jar java/program/my_java.jar

It works to call the java application but the problem is that "my_java.jar" looks for "my_file.txt" inside its directory.

my_file.txt location: /home/my_directory/java_program/my_file.txt

The problem is that in this way of executing the java application makes "my_java.jar" look for "my_file.txt" in the directory of "bashie.sh" and not its own directory.

How can I execute "my_java.jar" so that it looks for "my_file.txt" inside its own directory? I imagine the problem is that the bash script puts the java application into its own virtual memory space and I need to call the java application in such a way that it creates its own virtual memory space.

Thank you in advance for the help.


Top
 Profile  
 PostPosted: Wed Nov 06, 2013 7:20 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 548
hi,

Quote:
I imagine the problem is that the bash script puts the java application into its own virtual memory space

AFAIK, bash doesn't do such things.

the problem is as simple as not being in the right directory; so, first, change directory ;) to the right one.


Top
 Profile  
 PostPosted: Wed Nov 06, 2013 7:41 am   

Joined: Wed Nov 06, 2013 4:29 am
Posts: 2
Thank you. Simple cd helped.

On a side note, does c++ do what I wanted originally without the cd?


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP