A
A
AvvaTar2020-07-12 20:18:51
Java
AvvaTar, 2020-07-12 20:18:51

Error: Could not find or load main class. What is the problem?

There is a folder along the path D:\Tests\com\person In the person folder there are files: Person.java 5f0b40af4360f995904551.jpegand TestPerson.java (there is a main method in it) 5f0b40c06100e115222211.jpegAt the beginning of each class it is written: package com.person;
On the command line, I go to the Tests folder and compile. 5f0b412381571791193646.jpegEverything is fine. Subfolders are created in the out folder. The Person.class and TestPerson.class files appear along the D:\Tests\out\com\person path. When I try to start the program, it gives an error 5f0b422aaa94c840206365.jpeg
Environment variables are set 5f0b45b4ac1c6029871857.jpeg 5f0b45bfa7959123595520.jpeg
I tried to prescribe file paths at startup in different ways. Completely, through a dot ... The result is one - an error.
Where to look: writing the path on the command line or setting environment variables?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-07-12
@AvvaTar

java -cp out com.person.TestPerson

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question