I'm having trouble running my very first piece of java. I was able to compile it and produce a .class file, but then I was unable to run it for some reason. It might have something to do with the directory path. The file name is "Simple" and I have this saved in a folder called "newfolder".
I was able to compile Simple.class by typing in "javac newfolder/Simple.java", but when I typed in "java newfolder/Simple", this message appeared:
java: exception in thread “main” java.lang.NoClassDefFoundError: newfolder/Simple (wrong name: Simple)
Here is the original code that I typed in:
// This is a simple Java program.
public class Simple
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
I think that the answer here is up my alley, but I've somehow been unable to get it to work for me, so any assistance would be greatly appreciated. Thanks in advance!