• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

"root" vs. "user defined user"

 
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. I downloaded and installed the JDK 1.4.0_01 in /usr/java/j2sdk1.4.0_01
I, then, under my /root directory, I edited the .bash_profile which now displays this:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc]; then
.~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=$JAVA_HOME:/usr/java/j2sdk1.4.0_01
CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
BASH_ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME BASH_ENV PATH JAVA_HOME CLASSPATH
Now, here is my situation:
When I log-in to Linux using "root" and activate the command prompt, and type:
$ java -version
It works! But I heard that other than for installing software, one should always create a profile and not use "root" too much (because of the imminent danger of human error), so I created a user by the name of "untz". When I logged into Linux as "untz" and wrote a simple Java Applet, it didn't recognize the:
$ javac -verbose ButtonApplet.java
It didn't recognize the "javac" command! If anyone can help me with this, I would appreciate it, because I am yearning to start all of my future development on Linux, and don't really want to use "root" too much as the user. Also, if anyone sees any errors (in my .bash_profile), I would appreciate it if they can inform me.
Thanks again,
Unnsse
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that for permissions set for the PATH environmental variable, it only always the "root" user to use commands from $JAVA_HOME/bin, and other "users" aren't allowed... Can anyone help me in alleviating this problem? BTW, I am using Red Hat 7.3
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello...
OK, I found a .bash_profile in the /home/untz directory... I added the JAVA_HOME and CLASSPATH environmental variables... I also added $JAVA_HOME/bin to the PATH environmental variable.
After I saved and exited the file (.bash_profile located in /home/untz), I ran it using:
source .bash_profile
It then worked when I typed in:
$ java -version
Now, the problem is, I close the command prompt in Linux or if log back in as "untz" and type "java -version" it still doesn't recognize "java" from PATH. I have to use: source .bash_profile, each time I log-in as "untz". Can anyone help me with this?
 
Unnsse Khan
Ranch Hand
Posts: 511
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can someone please help me with this? I think that I put an inadequate subject heading and that's why no one wants to read this?
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess there's a few reasons why nobody has replied to this yet.
First, on the forum list it looks like you have lots of replies! It's only when you look inside you find that they are all from yourself.
Second, I was going to reply, but I saw that you have discovered what was going to say yourself, anyway.
Third, at that point it becomes a puzzling question, and we really need to know more about how your system is set up to find out why this doesn't work for you. For most people, simply modifying the user's startup file makes everything work, so there must be something else different in your system.
On that basis, here are a few questions:
1. Are you sure that your user is actually running bash when you login? Linux systems typically have several shells available, and although bash is usually the default, you could easily be running another one, which would ignore your .bash_profile in favour of its own startup file.
2. What are the file permissions of your .bash_profile ? which user "owns" it ?
3. Is anything alse running after your new settings when you log in and which which resets the PATH to something else? (.bashrc, for example?)
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) Log in as root
2) edit /etc/profile
3) add your variables, as well as setting your classpath and path variable to include your JDK stuff
4) save the changes.
5) log out completely
6) log back in
It should work /etc/profile sets environmental variables for ALL USERS.
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic