LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-19-2005, 10:15 PM   #1
MacaveliMC
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Rep: Reputation: 0
Java


Hi, need help with a jave question:

trying to export the path /usr/local/jdk/bin/ to my profile I guess, so I can use javac and what not, all those important java tools. When i use the command "export PATH=$PATH:/usr/local/jdk/bin" and then I type export to view the file, it is in there, but then when I type "source /etc/profile" to "reload" my profile like the instructions I was given said it would, it erases the path I just entered into the profile. I even checked it by typing "javac" afer I put it in, and it worked, then I typed the source command again, and tried typing "javac" again, and nothing. Can anyone help me with why this is just erasing the path I put in, instead of "reloading"? Thanks.

- Mike
 
Old 09-19-2005, 11:23 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You added that export line to /etc/profile and 'source'ing it doesn't work?
 
Old 09-20-2005, 08:35 AM   #3
MacaveliMC
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
yup, this is exactly what I typed and what came out:

root@macavelimc: export PATH=$PATH:/usr/local/jdk/bin
root@macavelimc: javac

- bunch-o-javac stuff printed out -

root@macavelimc: source /etc/profile
root@macavelimc: javac
bash: javac: command not found


also, if I typed the export line, and then close the root window, and open it again, javac doesn't work.

Last edited by MacaveliMC; 09-20-2005 at 09:28 AM.
 
Old 09-20-2005, 10:10 AM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Yeah... when you export the new PATH, then source /etc/profile, it overwrites the PATH variable. If you want it to be persistent, you'll probably want to put it IN /etc/profile.
 
Old 09-20-2005, 11:02 AM   #5
MacaveliMC
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Yeah! I found that out earlier. I opened Profile in the text editor, but it would not let me edit it! I couldn't even type. It said I do not own the file, and it says it's owned by root. I'm the administrator! Why can't I edit it? Any ideas?

Thanks
 
Old 09-20-2005, 11:27 AM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You must be logged in as root in order to edit /etc/profile. Alternatively, you could modify the path in ~/.bash_profile or ~/.profile.
 
Old 09-20-2005, 01:02 PM   #7
MacaveliMC
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
How do I log in as root? I thought I was root, since I am the only account. What does it mean to modify the path in ~/.bash_profile or ~/.profile? Do I type that in the terminal? thanks.
 
Old 09-20-2005, 01:06 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You should not be using root on a daily basis, and most distributions have you create a user account during setup.

~/.bash_profile and ~/.profile mean the files ".bash_profile" and ".profile" in your home directory. You can, as a user, open these and modify them to change your PATH for you.

To work as root, you'll need to use the 'su' utility.
 
Old 09-20-2005, 01:46 PM   #9
craigevil
Senior Member
 
Registered: Apr 2005
Location: OZ
Distribution: Debian Sid/RPIOS
Posts: 4,887
Blog Entries: 28

Rep: Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534Reputation: 534
RootSudo - Ubuntu Wiki
Quote:
Ubuntu uses sudo to allow a normal user administrative privileges. Thus the traditional UNIX 'root' account is disabled (i.e. it is not possible to log in as root). All the graphical configuration utilities use sudo by default. Thus when Synaptic or something similar asks you for a password, it is asking for your password.
 
Old 09-20-2005, 01:53 PM   #10
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Just to keep everyone up to date: MacaveliMC sent me an IM and I walked him through editing /etc/profile to modify the PATH set for both users and root. This seems to have resolved his problem.
 
Old 09-20-2005, 10:59 PM   #11
MacaveliMC
LQ Newbie
 
Registered: Sep 2005
Posts: 7

Original Poster
Rep: Reputation: 0
Yes. I had to type su- to get into root login, then use vi profile to edit profile. This worked for me.
 
Old 09-27-2005, 10:02 AM   #12
pgsmith
LQ Newbie
 
Registered: Sep 2005
Posts: 12

Rep: Reputation: 0
"Just to keep everyone up to date: MacaveliMC sent me an IM and I walked him through editing /etc/profile to modify the PATH set for both users and root. This seems to have resolved his problem."


Matir could you please post that here I am running into a similar problem
 
Old 09-27-2005, 04:16 PM   #13
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Quote:
Originally posted by pgsmith
"Just to keep everyone up to date: MacaveliMC sent me an IM and I walked him through editing /etc/profile to modify the PATH set for both users and root. This seems to have resolved his problem."


Matir could you please post that here I am running into a similar problem
Hi!

Read this:

http://www.linuxquestions.org/questi...40#post1841740

Regards!
 
Old 09-27-2005, 10:00 PM   #14
pgsmith
LQ Newbie
 
Registered: Sep 2005
Posts: 12

Rep: Reputation: 0
Quote:
Originally posted by Mega Man X
Hi!

Read this:

http://www.linuxquestions.org/questi...40#post1841740

Regards!

Well that helps but doesn't all in one

I am not trying to do anything with java I am just trying to set my path and it wont hold

Here is what I have right now

this part sets just fine
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games"
then I have
export PATH
PATH="$PATH:/u01/postware/adm:/u01/postware/ace:/u01/postware/cace:/u01/postware/presort:/u01/postware/merge:/u01/g1"
export PATH
PATH="$PATH"
and that is what is not setting I tried it all on the same line and that didn't work either

any help you could give would be great

Thanks
 
Old 09-27-2005, 10:48 PM   #15
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
Where are you putting that command? Command line? /etc/profile? /home/user/.bashrc? If you are using bash and placing that line at your /home/user/.bashrc, you must make sure that your user has bash as the default shell too. Otherwise, if you try running a program (like gnome run or simply from another shell) it won't work.

To make sure that your user has bash as the current, default shell, open and edit your "/etc/passwd". You don't have to understand all the file (if you want I can explain every field though) just change the default shell for bash to your user. Specify the whole path (/usr/bin/bash) not a relative or command one (bash).

Remember also that changing /home/user/.bashrc will make the changes only for "user". If you need the same variables for user2, you will need to add those at /home/user2/.bashrc

Good luck!

Last edited by Mega Man X; 09-27-2005 at 10:50 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java plugin installed correctly for Firefox but not able to view any java applet tvn Linux - Software 10 04-15-2010 02:13 AM
Java Programming: Java Runtime Environment not found when trying to compile murbz Linux - Software 2 03-26-2009 03:04 AM
Web start java not working (java works fine) powadha Debian 5 06-05-2004 12:57 PM
Updated Java... now java apps dont work zidane2010 Linux - Software 6 05-04-2004 08:02 PM
2 Questions: java calling system commands? PERL vs Java? randomx Programming 28 11-28-2003 08:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration