Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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] Mon, 01 August 2022 01:58 Go to next message
teddy bear is currently offline teddy bearFriend
Messages: 4
Registered: August 2022
Junior Member
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 06:11 Go to previous messageGo to next message
Sarika Sinha is currently offline Sarika SinhaFriend
Messages: 131
Registered: February 2010
Location: Bangalore, India
Senior Member
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?


Sarika Sinha
JDT Programmer
Re: How to create a jar with module-info in eclipse [message #1854089 is a reply to message #1854084] Mon, 01 August 2022 08:21 Go to previous messageGo to next message
teddy bear is currently offline teddy bearFriend
Messages: 4
Registered: August 2022
Junior Member
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 10:33 Go to previous messageGo to next message
Jay Arthanareeswaran is currently offline Jay ArthanareeswaranFriend
Messages: 128
Registered: July 2009
Senior Member
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 16:15 Go to previous message
teddy bear is currently offline teddy bearFriend
Messages: 4
Registered: August 2022
Junior Member
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: Fri Apr 19 03:09:59 GMT 2024

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

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

Back to the top