Reputation: 1
I am trying to write a simple program below.
public class HelloWorld {
public static void main (String[] args){
System.out.printIn("Hello, World");
}
}
I saved the file as "HelloWorld.java" and I navigated to the directory and typed in this command in my terminal javac HelloWorld.java
. This created a HelloWorld.class file. I then typed in java HelloWorld
in my terminal to run the file and I get this error
"Error: Main method not found in class HelloWorld, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application"
So the error message is telling me I don't have a main method inside the class, I have tried a capital M and lowercase m and I would still get the same error. Does anyone know why this is happening?
Upvotes: 0
Views: 217
Reputation: 11
You needed a lowercase "L" not an upcase "I". If it helps to remember "println" stands for "print line".
// Copy and paste this to correct your error.
System.out.println("Hello, World");
Upvotes: 1
Reputation: 2357
There is a wrong spelling
//System.out.printIn("Hello, World");
System.out.println("Hello, World");
you wrote a capital "I"
instead of small "L"
Upvotes: 0