[Penrose-discuss] Questions about creating a simple module

Shi Jun Zhang zhangshj at linux.vnet.ibm.com
Mon Sep 10 00:35:51 PDT 2012


On 9/8/2012 4:02 AM, Thomas Watson wrote:
>
> From
> http://planet.jboss.org/post/java_8_extensible_module_definitions_with_json
> I see that David Bosschaert has added support to penrose builds for json
> modue-info files.  This is great since it seems like it would be an easy
> way to insert the necessary json text file into an existing jar to make it
> a module without having to use the latest jigsaw javac to compile the
> module-info.java file.  But I am struggling with creating a very simple
> "hello module".  My basic assumption is that I could insert a
> module-info.json file into the root of a simple jar file that looked like
> this:
>
> {
> 	"module" :
> 	{
> 		"name" : "x.test.mod1",
> 		"version" : "1.0",
> 		"exports" : [ { "name" : "x.test.mod1"} ]
> 	}
> }
>
> But when I do that and follow the quick start guide for jigsaw I get the
> following error trying to add such a jar to the module
>
> 	jmod -L mlib install x.test.mod1.jar
> 	org.openjdk.jigsaw.ConfigurationException: x.test.mod1.jar: not a
> modular JAR file
>
> Am I doing something wrong?  How do I go about creating and running a
> modular JAR with json descriptor with penrose?
>
> Tom
>
HI Tom,

"jmod install" command can install a jmod file or a folder contains 
compiled module class files. A regular jar file plus a module info file 
cannot be installed directly.

You can use the following step to install a "hello module"

1. extract you x.test.modl.jar to a folder. For example, named as "classes"

2. move module-info.json to classes/META-INF/

3. jmod -L mlib install classes x.test.modl


-- 
Regards,

Shi Jun Zhang




More information about the penrose-discuss mailing list