- Many Platforms Make Light Work
- Linux: Where to Place Your Software
- Download a Copy of Your Required Linux Distribution
- Getting any Updates for Your Linux System
- Setting the Linux Date and Time
- Getting Out of Linux Back to Windows
- Installing a Desktop GUI on Your Linux System
- Downloading and Installing the Sun JDK
- Modifying the .profile File
- Testing the Software Installation
- Caution: Modifying the notroot Configuration
- Shutting Down Your Linux System
- Conclusion
Modifying the .profile File
We now want to be able to access the JDK files from a terminal window. This can be done for any user on your Linux system, but for simplicity we'll do it for the notroot user.
I'm often struck by the comparison between the Linux command line and the old DOS environment. Clearly, there are many differences between the two (e.g., Linux is a multitasking, multiuser operating system). However, it's an example of a situation where legacy knowledge (of DOS) can help you find your way in the more complex Linux environment. The .profile file is an important part of automating your software installations.
The .profile file is located in the user-specific folder called /home/<username>. So, the .profile file for notroot user is located in /home/notroot.
So run the following command:
sudo vi /home/notroot/.profile
Scroll to the bottom of this file and insert the following text (press the 'i' key followed by inserting the text):
JAVA_HOME=/opt/java/jdk1.6.0_12; export JAVA_HOME PATH=$JAVA_HOME/bin:"${PATH}" export PATH
Next, save (by pressing <Esc> followed by ':' and 'w') the updated .profile contents and then exit vi (by pressing <Esc> followed by ':' and 'q').
To test whether we can see the JDK, restart the virtual machine. This last step is not strictly necessary; we could just invoke the command source .profile. But let's do it the hard way and restart!