<div dir="ltr"><div>After reading the JEP, I am a bit unclear on how to launch a pre-compiled anonymous class, or if that will even be permitted.<br><br>The JEP gives this example:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">java HelloWorld.java</blockquote><br>Makes complete sense to me.  But then it goes on to say:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In this case the compiler chooses HelloWorld for the class name as an implementation detail, but that name still cannot be used directly in Java source code.</blockquote><div><br></div><div>It also says in an earlier part</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> An anonymous main class cannot be referenced by name</blockquote><div><br></div><div>So, if I package up my anonymous class for deployment in a jar, can I launch it with "java -cp myjar.jar HelloWorld"?  Or is the HelloWorld name an implementation detail that can not be relied on here?  My first impression on reading this JEP was that it was limited to source file programs like in the example (which would be a shame).</div><div><br></div><div>But with further reflection on this earlier statement that didn't seem correct:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">An anonymous main class resides in the unnamed package, and the unnamed package resides in the unnamed module. While there can be only one unnamed package (barring multiple class loaders) and only one unnamed module, ***there can be multiple anonymous main classes in the unnamed module***. Every anonymous main class contains a main method and so represents a program, thus multiple such classes in the unnamed package represent multiple programs.</blockquote><div><br></div><div>I am not sure what use multiple anonymous main classes would have if we can't target which one we want to launch, so I feel like I am missing something here.</div><br>Thanks for your time,<br>Nathan<br></div></div>