I'm in class, and no, before I begin, I don't need anyone to do my homework. The program is written, but the instructor said he grades using a scripted test bed, and the program (a simple Palindrome test, I'm a noob) must be executable as per his specifications or his test bed won't be able to run it, and if it doesn't run it, he isn't gonna try it manually and I fail the assignment (charmer I know.) Basically, his requirements are this:
There cannot be a package declaration in the application.
It must be executable from command line with simply this:
could not find or load main class Palindrome
When you execute
java <filename> it tries to find the file in the current directory. If it's not found, it returns an error saying
could not find or load main class.
So, in your case, you are either executing java command from different directory or you haven't compiles the class. For the former, you can specify the class file path with
-cp argument to command (e.g.
java -cp FULLPATH CopyFile), for the latter case, you need to compile the class with
javac first and then, execute it.