Error. Can't find `main' method
More symptoms: In System.err
, you get a stack trace
for an java.lang.NoSuchMethodException
and some harness messages.
java.lang.NoSuchMethodException at java.lang.Class.getMethod(Class.java) at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:89) at java.lang.Thread.run(Thread.java) JavaTest Message: main() method must be in a public class named JavaTest Message: ClassNotPublic in file ClassNotPublic.java
Answer: The class defining the test must be declared
public
and the class name must be the basename of the
.java
file; otherwise the harness will not be able to use reflection
to invoke the test.