Quick Answer: How to Set Java Path in Linux?

Quick Answer: How to Set Java Path in Linux?
Contents

Linux

  • Check if JAVA_HOME is already set , Open Console.
  • Make sure you have installed Java already.
  • Execute: vi ~/.bashrc OR vi ~/.bash_profile.
  • add line : export JAVA_HOME=/usr/java/jre1.6.0_04.
  • save the file.
  • source ~/.bashrc OR source ~/.bash_profile.
  • Execute : echo $JAVA_HOME.
  • Output should print the path.

How do I permanently set my Java path in Linux?

To Set PATH on Linux

  1. Change to your home directory. cd $HOME.
  2. Open the .bashrc file.
  3. Add the following line to the file. Replace the JDK directory with the name of your java installation directory.
  4. Save the file and exit. Use the source command to force Linux to reload the .bashrc file which normally is read only when you log in each time.

How do I set Java_home in Linux?

To Install the JDK Software and Set JAVA_HOME on a UNIX System

  • To set JAVA_HOME, do one of the following: For Korn and bash shells, run the following commands: export JAVA_HOME= jdk-install-dir. export PATH=$JAVA_HOME/bin:$PATH.
  • Change the permissions to enable you to run the GlassFish ESB Installer by running the following command: chmod 755 JavaCAPS.bin.
David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.