New candidate JEP: 445: Flexible Main Methods and Anonymous Main Classes, Preview
Ron Pressler
ron.pressler at oracle.com
Tue Apr 11 09:35:45 UTC 2023
> On 11 Apr 2023, at 02:53, Nathan Walker <nathan.h.walker at gmail.com> wrote:
>
>
> 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).
You can launch it with `java -cp myjar.jar HelloWorld`. From the perspective of *Java code* the class is anonymous, so you cannot refer to it by name from *Java code*, but the launcher can refer to it by the name of its file.
— Ron
More information about the amber-dev
mailing list