Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
01-30-2007, 07:52 AM
|
#1
|
|
Member
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120
Rep:
|
Inserting ENV. VARS. for all of Linux to use
Hey everyone,
I just would like to know how I can specify environment variables such as JAVA_HOME, update PATH, etc. to be used everywhere in Linux. Currently I specify it in /etc/bash.bashrc (Kubuntu & SuSE). Where can I place it sothat if I want to open a Java app from my desktop, that it will automatically see where the java app is and use that to open up and execute the JAR file?
I hope I am making sence.
Thanks
|
|
|
|
01-30-2007, 09:29 AM
|
#2
|
|
Senior Member
Registered: Oct 2003
Posts: 2,280
Rep: 
|
It varies with the distro, but in general, the system wide environmental variables are normally setup in /etc/profile. However, using /etc/bashrc should accomplish the same thing. Not sure exactly what you are trying to do. To run a .jar file in linux, you would usually run:
$ java -jar app.jar
if you have the java /bin directory in PATH. To have a launch icon from the desktop you could create a bash script(s) that could do that. Post back if you need more details.
Last edited by kilgoretrout; 01-30-2007 at 09:44 AM.
|
|
|
|
02-01-2007, 12:04 AM
|
#3
|
|
Member
Registered: Jun 2004
Location: South Africa
Distribution: Ubuntu
Posts: 120
Original Poster
Rep:
|
Thanks kilgoretrout.
The thing is, I did make scripts for the stuff to run but you have to run it from the console in order to pick up the JAVA_HOME var in bash.bashrc and I had to respecify the JAVA_HOME var the whole time in the scripts I'm running.I want to click on a desktop link and let it have access to the JAVA_HOME and new PATH vars without running it from the console. Know what I mean?
|
|
|
|
02-01-2007, 01:57 PM
|
#4
|
|
Senior Member
Registered: Oct 2003
Posts: 2,280
Rep: 
|
I can illustrate what I'm talking about by example; don't know if this will help. Say you have a java app located in ~/myjava called "coolapp.jar". You can create a bash script to launch it with:
#!/bin/bash
cd ~/myjava
java -jarr coolapp.jar
Lets name the above script "bscoolapp" and make it executable(chmod +x bscoolapp) so it will run. Also, lets put bscoolapp in ~/scripts. Now if you are in ~/scripts, you should be able to launch coolap.jar by running:
$ ./bscoolapp
It should work. Now say you don't want to open a console and cd into ~/scripts every time you want to launch coolapp.jar. Make another script called "do_bscoolapp" like so and put it in your home directory:
#!/bin/bash
cd ~/scripts
./bscoolapp
do "chmod +x do_bscoolapp" to make it executable. Now, open your home directory in konqueror or nautilus. If you doulbe click on do_bscoolap it should launch coolapp.jar. If it works, you can make a shortcut link to it on your desktop and open coolapp.jar by clicking on it.
This is a general technique I've used for many years to create a launch icon on the desktop for applications that can only be launched from the command line.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:26 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|