Difference between revisions of "Java"

From Bashlinux
Jump to: navigation, search
 
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
+
=== How to install java system wide on Fedora/CentOS Linux ===
== How to install java system wide on Fedora/CentOS Linux ==
 
 
Download the JRE rpm file from Oracle website, then add java to alternatives as follow:
 
Download the JRE rpm file from Oracle website, then add java to alternatives as follow:
 
 
<pre><nowiki>
 
 
  alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000
 
  alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000
 
  alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000
 
  alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000
 
</nowiki></pre>
 
 
 
On 64-bit systems, replace the last command with:
 
 
<pre><nowiki>
 
 
  alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000
 
  alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000
</nowiki></pre>
 
  
 +
On 32-bit systems, replace the last command with:
 +
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000
  
== How to install java system wide on Ubuntu/Debian Linux ==
+
=== How to install java system wide on Ubuntu/Debian Linux ===
 
 
 
Download the binary file from Oracle website, place it where the JVMs are used to be:
 
Download the binary file from Oracle website, place it where the JVMs are used to be:
 
<pre><nowiki>
 
 
  mv jdk-6u32-linux-x64.bin /usr/lib/jvm/
 
  mv jdk-6u32-linux-x64.bin /usr/lib/jvm/
 
  cd /usr/lib/jvm
 
  cd /usr/lib/jvm
 
  chmod +x jdk-6u32-linux-x64.bin
 
  chmod +x jdk-6u32-linux-x64.bin
 
  ./jdk-6u32-linux-x64.bin
 
  ./jdk-6u32-linux-x64.bin
</nowiki></pre>
 
 
  
 
Update alternatives:
 
Update alternatives:
 +
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
 +
update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so" 1
  
<pre><nowiki>
+
On 32-bit systems, replace the last command with:
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
 
 
  update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/lib/i386/libnpjp2.so" 1
 
  update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/lib/i386/libnpjp2.so" 1
</nowiki></pre>
 
 
 
On 64-bit systems, replace the last command with:
 
 
<pre><nowiki>
 
update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so" 1
 
</nowiki></pre>
 

Latest revision as of 00:59, 7 June 2015

How to install java system wide on Fedora/CentOS Linux

Download the JRE rpm file from Oracle website, then add java to alternatives as follow:

alternatives --install /usr/bin/java java /usr/java/latest/bin/java 20000
alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 20000
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000

On 32-bit systems, replace the last command with:

alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 20000

How to install java system wide on Ubuntu/Debian Linux

Download the binary file from Oracle website, place it where the JVMs are used to be:

mv jdk-6u32-linux-x64.bin /usr/lib/jvm/
cd /usr/lib/jvm
chmod +x jdk-6u32-linux-x64.bin
./jdk-6u32-linux-x64.bin

Update alternatives:

update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_32/bin/java" 1
update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/jre/lib/amd64/libnpjp2.so" 1

On 32-bit systems, replace the last command with:

update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.6.0_32/lib/i386/libnpjp2.so" 1