Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Sunday, 27 March 2022

Install Java with Apt on Ubuntu 20.04


sudo apt update

java -version

Command 'java' not found, but can be installed with:

sudo apt install default-jre              # version 2:1.11-72, or

sudo apt install openjdk-11-jre-headless  # version 11.0.14+9-0ubuntu2~20.04

sudo apt install openjdk-16-jre-headless  # version 16.0.1+9-1~20.04

sudo apt install openjdk-17-jre-headless  # version 17.0.2+8-1~20.04

sudo apt install openjdk-8-jre-headless   # version 8u312-b07-0ubuntu1~20.04

sudo apt install openjdk-13-jre-headless  # version 13.0.7+5-0ubuntu1~20.04


sudo apt install default-jre

<...>

java -version

openjdk version "11.0.14" 2022-01-18

OpenJDK Runtime Environment (build 11.0.14+9-Ubuntu-0ubuntu2.20.04)

OpenJDK 64-Bit Server VM (build 11.0.14+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)


sudo apt install default-jdk

<...>

javac -version

javac 11.0.14


Thursday, 5 May 2016

Upgrade java 1.7 to 1.8 in Ubuntu 14.04


java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
echo $JAVA_HOME

Set Java home path,

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64

Don't pass MaxPermSize to Java 8+

java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~14.04-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

Thursday, 3 March 2016

Set Java MaxPermSize and Min Heap Size

MaxPermSize

The MaxPermSize is the maximum size for the permanent generation heap, a heap that holds the byte code of classes and is kept separated from the object heap containing the actual instances.

Min Heap Size

Min Heap Size (-Xms) is a costly operation. Especially in case of financial applications this could mean delays. With similar real-time requirements, it could be a good idea to set -Xms and -Xmx to the same value.

Example for setting MaxPermSize and MinPermSize in Linux.

Go to bin dir,
cd /opt/apache-tomcat-7.0.61/bin
add a new file with
vi setenv.bat
set JAVA_OPTS=-Dfile.encoding=UTF-8 -Xms512m -Xmx4096m -XX:PermSize=128m -XX:MaxPermSize=512m

Ref: http://stackoverflow.com/questions/6902135/side-effect-for-increasing-maxpermsize-and-max-heap-size