+ 1
Error: Could not find or load main class ExampleProgram
I keep on getting that error after I was successfully able to run the java code, but now I cant run the class After I types javac "C:\Program Files (x86)\Notepad++\ExampleProgram.java" everything was fine, but when I typed java ExampleProgram I cannot get "Hello World" to appear
5 ответов
+ 2
Did you compile the code and did you do everything without mistakes?
+ 1
Did you use the javac method in the console(cmd) as sololearn explained it?
0
yes I did
I made sure but it keeps saying that it cannot find or load main class
0
public class Tito{
public static void main(String[] args){
System.out.println("Hello World");
}
}
I saved it as Tito.java
0
I realize that this is MEGGGAAAA late but...
I was having this issue all morning, I figured it out using google ^~^ for me, I was able to get it to work by using "set CLASSPATH=" command on the cmd. For example, my practice file is located "E:\Practice\ExampleProgram.class" so on cmd, I had to enter "set CLASSPATH=E:\Practice"
There is a way to set the CLASSPATH to the directory of your choosing but this particular method will only work for the currently opened cmd box. If you use this method, you will have to do it each time you open a new cmd promt. Good luck and happy coding!!