Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

  • Print
  • + Share This

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):

export JAVA_HOME
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!

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.