Some Common Java Commands

  • Home
  • /
  • Some Common Java Commands
Some Common Java Commands

Some Common Java Commands

General 16 Jun 2020 Siva Nadesan

Overview

In this article we will see some common java commands.

  • Find Java Version java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
  • Find Java Compiler Version javac -version
javac 1.8.0_252
  • Compile Java Code
    javac my-program.java

  • Run Java Code
    java my-program

  • Find the process ID. Here datastage should be replaced with the process name which you are trying to find
    ps -ef | grep datastage

  • Change the default java version if you have multiple java installed
    sudo update-alternatives --config java

  • Find the java home
    java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home'

  • Find Max Heap Size and Max RAM in a machine
    java -XX:+PrintFlagsFinal -XX:MaxRAM=1g -version | grep -Ei "maxheapsize|maxram"



About The Authors
Siva Nadesan

Siva Nadesan is a Principal Data Engineer. His passion includes data and blogging about technologies. He is also the creator and maintainer of www.entechlog.com

LinkedIn

Share: