I just installed JDK in Ubuntu with sudo apt-get install openjdk-6-jdk command,
after the installation where's the Java bin directory located? And how can I set the environment path for that directory? I have little experience with Ubuntu, can anyone give some advice or suggest any good website for reference?
Join Stack Overflow to learn, share knowledge, and build your career.
|
|
||||
|
|
|
set environment variables as follows Edit the system Path file /etc/profile
Add following lines in end
Then Log out and Log in ubuntu for setting up the paths.. for reference http://javaandme.com |
|||||||||||||
|
|
Let me Simplify , first download JDK from Oracle Website : Link 2] Then Extract it 3] Create a folder (jvm) in /usr/lib/ i.e /usr/lib/jvm 4] move the extracted folder from the jdk to /usr/lib/jvm/ *Note : use terminal , sudo , mv command i.e. sudo mv 5] Create a .sh file at /etc/profile.d/ eg: /etc/profile.d/myenvvar.sh 6] In the .sh file type
*Note : use terminal , gedit and sudo eg: sudo gedit myenvvar.sh 7] Turn Off the Computer, after all these steps and Restart it 8]Open Terminal , and type
9] Check the output , then type
10] Check the output and be happy :) |
|||
|
|
|
||||
|
|
|
if you have intalled only openJDK, the you should update your links, because you can have some OpenJDK intallation.
after this
add the following line in the file
you can get you java version with
|
|||
|
|
|
To set up system wide scope you need to use the /etc/environment file is the location where you can define any environment variable. It can be visible in the whole system scope. After variable is defined system need to be restarted. EXAMPLE :
Add like following :
Here is the site you can find more : http://peesquare.com/blogs/environment-variable-setup-on-ubuntu/ |
|||||
|
|
Installation of Oracle Java:
export JAVA_HOME=/home/abu/Java/jdk1.8.0_45/ export PATH=$JAVA_HOME/bin:$PATH
|
|||
|
|
|
To Set JAVA_HOME / PATH for a single user, Login to your account and open .bash_profile file
Set JAVA_HOME as follows using syntax export
Set PATH as follows:
Feel free to replace /usr/java/jdk1.5.0_07 as per your setup. Save and close the file. Just logout and login back to see new changes. Alternatively, type the following command to activate the new path settings immediately:
OR
Verify new settings:
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:
Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell. To Set JAVA_HOME / PATH for all user, You need to setup global config in
Next setup PATH / JAVA_PATH variables as follows:
Save and close the file. Once again you need to type the following command to activate the path settings immediately:
OR
|
|||
|
|
|
open jdk once installed resides generally in your /usr/lib/java-6-openjdk As usual you would need to set the JAVA_HOME, calsspath and Path In ubuntu 11.04 there is a environment file available in /etc where you need to set all the three paths . And then you would need to restart your system for the changes to take effect.. Here is a site to help you around http://aliolci.blogspot.com/2011/05/ubuntu-1104-set-new-environment.html |
|||
|
|
|
Ubuntu installs openjdk6 to |
|||
|
|
|
Java is typically installed in /usr/java locate the version you have and then do the following: assuming you are using bash (if you are just starting off, i recommend bash over other shells) you can simply type in bash to start it. edit your ~/.bashrc file and add the paths as follows: for eg. vi ~/.bashrc insert following lines:
after you save the changes, exit and restart your bash or just type in bash to start a new shell type in export to ensure paths are right type in java -version to ensure java is accessible |
|||||
|
|
It should put java in your path, probably in /usr/bin/java. The easiest way to find it is to open a term and type "which java". |
|||
|
|