4
After executing the command javac normally and create the file .class,
I try to execute the command java plus it gives this problem of not being able to locate or load the main class.
I think it might be a confusion of mine in the environment variables because I’m starting now to learn programming and really not mean much about such variables.
Anyway I used this "step-by-step" in the link below to configure the system variables:
http://tisuperinfo.blogspot.com.br/2013/01/problema-javac-nao-e-reconhecido-como.html
I used only the commands javac and java in the cmd, out of those to locate in directories.
Using this code below, right after the java command to run the program, it occurs. Error: Unable to find or load Cprincipal main class.
import javax.swing.JFrame;
public class CPrincipal {
public static void main (String args[]){
JFrame janela = new JFrame ();
janela.setSize(500,300);
janela.setVisible(true);
}
}
Could [Edit] your question and add your code to it, the commands you used and the console output?
– Math
From what you said about the main class I believe the file class. java you made has a main method, without the main method the application will not start. The main is the entry point of the program, which is why the program starts.
– ooredroxoo
Place exactly the error message that occurred and when it occurred.
– Guilherme Nascimento
I think the problem is that you didn’t correctly define the variable PATH.
– someonewithpc
I answered your question with a broader question that can help more future users of the site with the same question: http://answall.com/questions/82229/erro-n%C3%A3o-%C3%A9-poss%C3%Advel-localize-nor-load-a-class-main-in-java-eclipse/
– Maicon Herverton