How Do You Run (Execute) a Java Program That Compiled Successfully?

Problem scenario
You try to run a compiled Java program.  You see the .class file as a result of your compilation.  But when you run java ContInt.class, you get this error:

"Error: Could not find or load main class ContInt.class"

How do you run the bytecode (to have your Java program execute after compilation)?

Solution
Omit the ".class" when you run the "java" command.  In other words, run this command:  java ContInt

Leave a comment

Your email address will not be published. Required fields are marked *