2 Minutes To Code (β Version)

'java' command - 2 minute tutorial

How to add packages in classpath

If you need to add java packages to the classpath, just add the folder that contains the packages to the classpath.

In the image below, notice that the folder binaries contains a java package com which has a java class com.HelloWorld.class in it. Now just add the binaries folder in classpath using -cp or -classpath option and the package will automatically get included in the classpath.

So the complete command to run teh program is java -classpath binaries com.HelloWorld