Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to create a jar with module-info in eclipse(The Jar generated is different with the Jar command line created )
How to create a jar with module-info in eclipse [message #1854080] Sun, 31 July 2022 21:58 Go to next message
Eclipse UserFriend
I would like to creat a jar file which inludes a module-info. it specify main-class.
I export a testA. jar in eclipse
and I create a testB.jar in command line
I found they are different size, module-info.class in testA.jar and testB.jar.

I want to know how to create a jar with module-info in eclipse
Re: How to create a jar with module-info in eclipse [message #1854084 is a reply to message #1854080] Mon, 01 August 2022 02:11 Go to previous messageGo to next message
Eclipse UserFriend
I see the module-info.class in the exported jar file.
I used Export as Jar file with "Export generated class files and resources" checked.

Can you provide the steps followed by you? Which Eclipse version and Java version are you using?
Re: How to create a jar with module-info in eclipse [message #1854089 is a reply to message #1854084] Mon, 01 August 2022 04:21 Go to previous messageGo to next message
Eclipse UserFriend
Sarika Sinha wrote on Mon, 01 August 2022 06:11
I see the module-info.class in the exported jar file.
I used Export as Jar file with "Export generated class files and resources" checked.

Can you provide the steps followed by you? Which Eclipse version and Java version are you using?


Thanks for your reply.
Eclipse version is the lastest 2022‑06

Using eclipse exports the jar. the module-info.class in the jar file is same size as bin/module-info.class.
it will not work to jmod create module using the jarfile

Using command line
jar --create --file my.jar --main-class my.main -C bin .
the size of the module-info.class in the jar file is larger than bin/module-info.class.
it works


Re: How to create a jar with module-info in eclipse [message #1854097 is a reply to message #1854089] Mon, 01 August 2022 06:33 Go to previous messageGo to next message
Eclipse UserFriend
Are you saying you used Eclipse to compile the module on both occasions? It is quite likely that the class files compiled by Javac and Eclipse Compiler can be of different size.
Re: How to create a jar with module-info in eclipse [message #1854112 is a reply to message #1854097] Mon, 01 August 2022 12:15 Go to previous message
Eclipse UserFriend
Jay Arthanareeswaran wrote on Mon, 01 August 2022 10:33
Are you saying you used Eclipse to compile the module on both occasions? It is quite likely that the class files compiled by Javac and Eclipse Compiler can be of different size.


No, I compile the module-info in Eclipse, the module-info.class output to bin folder. I use the class to generate jar files.
export the jarfile with eclipse, the size of module-info.class is same as bin/module-info.class. but with command line jar --create the jarfile, its module-info.class is larger
Previous Topic:Formatter and block comment
Next Topic:How does autocomplete proposals sort by relevance work?
Goto Forum:
  


Current Time: Sat Jul 05 01:35:36 EDT 2025

Powered by FUDForum. Page generated in 0.04820 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top