I have a simple HelloWorld program in Eclipse. I run it on the IDE and everything works fine. Now I wish to see the same helloworld program output on the command line, I see the below:
Error: could not find or load main class TestCode
Caused by: java.lang.ClassNotFoundException: TestCode
I have a project structure in the eclipse workspace: project-> src-> package1->TestCode.java
I can reach upto package1 directory and then successfully perform :
javac TestCode.java
I see that the TestCode.class file is created as well
but when i perform the run, I get the error as shown
java TestCode
Error: could not find or load main class TestCode
Caused by: java.lang.ClassNotFoundException: TestCode
ClassPath variables are all checked.
I tried with exporting a jar and running it on the command line. It works.
what is the error here? Am I doing anything wrong or any theory I am missing? Please let me know