You need to run the .class file containing the public static void main(String[] args) method.
Here, your HelloWorld.java file may contain a class method with main() . So you can run it.
This is because the execution of any Java program begins with a call to main() .. The JVM needs an entry point to your code .. What is main() .. If it does not find it .. It will not work.
So, make sure that any class file you use must have a main() method.
UPDATE : - And for the starting point, perhaps you can skip using packages .. Just go with a simple Java class without packages.
source share