- #1
mindauggas
- 127
- 0
Hi,
I wanted to try to use cmd to compile and run a program in java. I have sucessfully compiled it. The compiler is working properly (C:\new> javac output the compilers functions), but I'm always getting the same error: "Error: Could not find or load main class hello".
When I specify the class path ("java -cp C:\new hello") the program works.
How to solve this dilemma to succesfully run the programms in cmd?
P.S. the source file name "hello.java", the class file name is "hello.class" and the specified class is "hello". Even though only the <>.class and the class name itself has to match I wanted to make sure everything is in tact there.
Help really needed here.
I wanted to try to use cmd to compile and run a program in java. I have sucessfully compiled it. The compiler is working properly (C:\new> javac output the compilers functions), but I'm always getting the same error: "Error: Could not find or load main class hello".
When I specify the class path ("java -cp C:\new hello") the program works.
How to solve this dilemma to succesfully run the programms in cmd?
P.S. the source file name "hello.java", the class file name is "hello.class" and the specified class is "hello". Even though only the <>.class and the class name itself has to match I wanted to make sure everything is in tact there.
Help really needed here.
Last edited: