Hello i'm currently learning java i'm taking a course and we're diving into Maven proyects. The thing is that i'm getting an error when i tried to run a simple "Hello World" and my teacher couldn't find a solution
This is the code
package bmt;
/**
* Hello world!
*
*/
public class Saludo
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
This is the error
Error: Could not find or load main class Saludo
Caused by: java.lang.NoClassDefFoundError: bmt/Saludo (wrong name: Saludo)
I've seen multiple solutions but I just couldn't understand them or didn't work. This only happen with a Maven proyect and if I create a CLASSPATH a "Hello World" without Maven stops working too, can someone help me please
Steps for manual as it seems you have just started Java Programming Since your code looks like this it includes package you have to consider it.
Suppose your directory looks like this
just compile it by getting into your package
then go to the parent directory
The console will look like this
Now just execute the Code here by typing