Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a little Java program that is supposed to be run with a custom amount of memory, to do this I need to create a shell script (I've created a .bat script for windows with no problem). BUT, under Linux my script runs correctly only from the command line - I need to run it at double click as well. The script is supposed to launch a .jar (Java executable) file that's in the same directory. Here's my script (called "start_java"):
It runs successfully from the command line like "./start_java" & Enter.
At double click it wont launch - I think it's about specifying the directory where Java should find the "MyApplication.jar" - here is my problem since I don't know how to do it. From the command line we say "./" to specify the current dir, but using the double click method - the application (java) thinks probably that the current folder is the directory where it is installed.
Hope you got me correctly (the CD $PWD didn't work either).
Thanks for the hint. I realized whats the matter: when using double click the "PWD" variable points to my home dir, instead of the directory from where the shell script has been launched - and I have no clue how to fix this.
-from the command line I get a file (thefile.txt) on the desktop containing "/home/brian/Desktop"
-by double clicking the shellscript (from the Desktop as well) I get same file with only "/home/brian"
So, my problem is: How to let the shellscript correctly identify the folder it has been launched from?
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 220.127.116.11, KDE 3.5.8 and KDE 4.0 beta, Plu
Is the same file being overwritten?
First run it like you say, then delete the thefile.txt and run it again where you want the second time. If it is correct then the second attempt is not forcing and overwrite.
I create the "thefile.txt" from the shell script just to prove that the shellscript behaves differently when it is being launched by double-click or from the command line - both cases have different understanding about the 'current directory' - which is why I can't run the "MyApplication.jar" file double-clicking the launcher ( the "start_java" file ).
Thanks for your time.
I have the same problem, but I do not rely on desktop icons. State the the PATH environment variable or use the full path to the program.
The reason why the script is behaving strangly. All programs that are loaded gets their own seperate environment because Linux is a multi-tasking and a virtual memory OS. To get the script run in the same environment, you type ". [script name]". The dot says in this environment, run this script.
In your script, I suggest adding . on the same line that reads java before java. This will make it easier for Linux to run the program in the same environment as the script is run.