Berikut ini adalah langkah2 jika anda ingin menginstall java di linux
1. Download file jdk kemudian misalnya kita taruh di /usr/local
2. Masuk ke direktori /usr/local dan extract file jdk anda
# cd /usr/local
# tar xvzf jdk1.5.0.tgz
3. Tambahkan path java ke bash linux menggunakan editor vi
# cd
# vi .bash_profile
4. Ubah .bash_profile anda menjadi berikut ini
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
export JAVA_HOME=/usr/local/jdk1.5.0
export PATH=$PATH:$JAVA_HOME/bin
~
~
~
~
".bash_profile" 16L, 262C
penambahan dimualai dari export JAVA_HOME sampai $JAVA_HOME/bin
5. Simpan kalau sudah anda edit, kemudian ketik kode berikut agar .bash_profile anda reload
# . .bash_profile
6. Kalau sudah, silahkan anda cek apakah java sudah terinstall di linux anda
# javac
output nya:
Usage: javac
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath Specify where to find user class files
-cp Specify where to find user class files
-sourcepath Specify where to find input source files
-bootclasspath Override location of bootstrap class files
-extdirs Override location of installed extensions
-endorseddirs Override location of endorsed standards path
-d Specify where to place generated class files
-encoding Specify character encoding used by source files
-source Provide source compatibility with specified release
-target Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J Pass directly to the runtime system