Up to date syntax documentation?

Alan Bateman Alan.Bateman at oracle.com
Wed Oct 14 16:48:20 UTC 2015


On 14/10/2015 17:14, Philippe Marschall wrote:
> Hi
>
> I'm looking for an up to date syntax documentation for the 
> module-info.java. Specifically I'm looking for the syntax for optional 
> dependencies and specifying the main class. The most up to date 
> information I could find was [1] but this doesn't cover optional 
> dependencies. Googling suggests the following syntax
>
> require optional module-name;
>
> But this doesn't seem to work. Googling also suggests there is/was 
> syntax for specifying the main class but none of the example seem to 
> work anymore.

The main project page [1] has links to all the current documents, 
including the draft "Modules in the Java Language and JVM" page.

I suspect it may be a surprise but there isn't any support for optional 
dependences in the proposed design or prototype. At least for the JDK 
modularization effort then we've been able to mostly eliminate the 
original needs for this by moving to services.

The module main class is not in the module declaration. If you are 
building a modular JAR then you can specify it to the jar command with 
--main-class $MAINCLASS. If the initial module is exploded on the file 
system then you can specify the main class to the java launcher with -m 
$MODULE/$MAINCLASS.

-Alan

[1] http://openjdk.java.net/projects/jigsaw/


More information about the jigsaw-dev mailing list