<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi Ron,<br>
</p>
<p>JLS 12.1 states that "The Java Virtual Machine starts execution
by invoking the <b>method main</b> of some<b> specified class or
interface</b>..."</p>
<p>You are right that Java SE doesn't say how exactly JVM is
launched.<br>
The JCK handles this by requesting an user to provide a command
that start his tested JVM.<br>
The command can be as script, a wrapper code, etc.<br>
But it should be able to take a test main class name as an
argument.<br>
There are other ways to start JVM (for example, manually) but
still the JCK should be able<br>
to feed it with test main class name.</p>
<p>Also JCK compiler tests are run in two steps:<br>
- a first step: to run <b>tested </b>Java compiler that compile
test sources and generate classes<br>
- a second step: to run <b>reference </b>JVM to execute the
generated classes - this is to verify that tested compiler
generate proper classes.<br>
</p>
<p>To summarize: the JCK should be able to find out a test class
name to be able to run it.</p>
<p>If the JCK doesn't know classes generated then it can skip the
second step.<br>
But obviously this would make JCK tests much weaker.<br>
</p>
<p>Thanks,<br>
Leonid<br>
JCK Team<br>
</p>
<div class="moz-cite-prefix">On 11/28/2023 4:22 AM, Ron Pressler
wrote:<br>
</div>
<blockquote type="cite" cite="mid:4A8FF91C-0074-443E-9D80-7E9B7948B725@oracle.com">
<pre class="moz-quote-pre" wrap="">
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On 27 Nov 2023, at 20:25, Leonid Arbuzov <a class="moz-txt-link-rfc2396E" href="mailto:leonid.arbouzov@oracle.com"><leonid.arbouzov@oracle.com></a> wrote:
How the JCK can launch a test class not knowing its name in an implementation-independent manner?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Is launching *any* Java program specified SE even if you do know the name of its main class?
For example, JLS §12.1.4 specifies the `main` method but doesn’t specify how the main class is launched. Does it matter, then, that the chosen name for the main class is implementation-specific given that launching the main class is also implementation-specific?
Perhaps the best way to test implicit classes, then, is from *within* the implicit class itself. Like any other main class, it is launched by some implementation-specific mechanism, but once you’re in it, everything is known. You can then get the chosen class name with `this.getClass()…`.
— Ron</pre>
</blockquote>
</body>
</html>