jmod request

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Thu Dec 10 13:16:36 PST 2009


Jonathan Gibbons wrote:
> jmod is currently not friendly to being invoked directly from Java code.
>
> It would be nice to be able to avoid unnecessary execs when running 
> jmod from Java.  Here are some issues and corresponding suggestions:
>
> -- Librarian.run currently calls System.exit.        It is generally 
> better to have run methods like this either throw exceptions or give 
> an integer return code.   Either way, the condition should be caught 
> in main, and the corresponding System.exit should be called there. 
> (Generally, "main" is the only reasonable place to call System.exit)
>
> -- Librarian directly calls System.out and System.err
>       It would be better to be able to pass it streams (or Writers) to 
> use.  The streams can default to System.out and System.err if the user 
> does not provide anything.
>
> In the short term, it would be nice to have a method like
>    class Librarian {
>        static int run(String[] args, Writer out)
>
>   }
>
> Longer term, we should look at providing an Ant task and/or JSR 199 API.
>
> -- Jon
Make this a double request, because you typically need to invoke jmod 
twice to create and install a module:

> $BIN/javac -d modules -modulepath modules $(find src -name '*.java')
> $BIN/jmod -L mlib create
> $BIN/jmod -L mlib install modules hi
> $BIN/java -L mlib -m hi

-- Jon



More information about the jigsaw-dev mailing list