S
S
Slytherin2021-12-28 08:31:01
Java
Slytherin, 2021-12-28 08:31:01

For what reason can the main class not be found?

I am compiling a package using mvn package. Then I run the command java -cp c:\...\test.jar ru.application(class location). Gives an error that the main class was not found. I also tried to do it on a simple package, everything works there.
What can interfere with finding the main class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-12-28
@Slytherin

Good afternoon.
Your main() method is not located in a public class. Add an access modifier to the MySolution class public
Also I can assume that your jar does not have MANIFEST.MF
Or it is, but the class containing the main() method is not specified

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question