Test Java in Command Line

naveen.mannam
1 min readAug 21, 2018

Simple hello world code to test java installation by running java program in command line.

  • Create a test folder with a file named Hello with the extension as .java.
  • Name of the file and the class name should be same.
  • Sample code

# Run Code

For any issues with the execution, need to check the classpath, path and java_home

Below are the variables

CLASSPATH = C:\Program Files\Java\jdk-10.0.2\bin;C:\Program Files\Java\jre-10.0.2\bin

JAVA_HOME = C:\Program Files\Java\jdk-10.0.2\bin

PATH = C:\Program Files\Java\jdk-10.0.2\bin; C:\Program Files\Java\jre-10.0.2\bin

JAVA_HOME has to be set under “user variables”

PATH and CLASSPATH has to be set under “system variables”

# Download latest version of Java

http://www.oracle.com/technetwork/java/javase/downloads/index.html

--

--