Intellij fat one jar artifact does not generate a working output
Asked Answered
M

2

3

Intellij fat one jar artifact does not generate a working output. Below you can see my settings and project structure(left). When i click build artifact and then the generated output, nothing happens.

enter image description here

enter image description here

enter image description here

Mendez answered 17/7, 2017 at 22:54 Comment(14)
What is the output in the command line when you run it as java -jar …?Milieu
@Milieu Could not find main class or loadMendez
If any of the jars you add to the dependencies has its own META-INF/Manifest.MF file, it will override the manifest where you specify the main class, see here for the solution.Milieu
@CrazyCoder, tried it and still getting same error "COuld not find main class or load" etc.. See edited picture please. Maybe one lib i am depending on is project library, can problem be tied to that?Mendez
What's inside the generated jar manifest file? Does it specify the correct main class?Milieu
Yes it is, see new image on the question pls.Mendez
Do you have this class in the jar? What's the source structure? Show this main class in the editor and the project view.Milieu
Yes it has the main class in the jar file. I added image for you. What do you mean by source structure? It is javafx project with ant build i guess. İ didnt touch any other settings. Can 2 version of java being installed can be problem?Mendez
Please share the Minimal, Complete, and Verifiable example, otherwise it's hard to tell what's wrong, sorry.Milieu
what? You are given everything you asked for. Check the new image. It is illogical to write "question is not enough" after you asked so many questions.Mendez
I mean that everything looks correct from what you have provided, so I can't tell what can be wrong without looking at the project myself locally.Milieu
For example, see here, user didn't specify the correct file name. There could be also something else that is hard to spot from the screenshots.Milieu
dropbox.com/s/dckwabbbod6n8rz/LdapTool.zip?dl=0 can you look at it if you have time. ThanksMendez
mssql-jdbc-6.2.0.jre8.jar has the digital signature (MSFTSIG.RSA and MSFTSIG.SF files). When the jar is repackaged, the signature becomes broken. If you remove these files from the jar, it should start fine.Milieu
M
12

mssql-jdbc-6.2.0.jre8.jar has the digital signature (MSFTSIG.RSA and MSFTSIG.SF files). When the jar is repackaged, the signature becomes broken. If you remove these files from the jar (either original one or the artifact), it should start fine.

Vote for this issue to get it addressed in the future updates.

Milieu answered 18/7, 2017 at 14:27 Comment(5)
Thank you for your time and effort. Last question.. Should i remove it from output jar or from lib's folder one? (Couldn't find it in the jar)Mendez
If you remove it from the artifact, you will have to do it every time you rebuild the jar, so it makes sense to remove it from the lib instead.Milieu
@Milieu how I can find which jar causing the problem?Carney
@Carney extract the jars and see if there are *.SF/*.RSA files inside.Milieu
Thanks CrazyCoder. It took me a while to find this question but it gave me a good pointer. In my case the file in question is lorg.conscript:conscrypt-openjdk-uber: 2.5.1 containing the RSA. Removal allowed the application to run. I now have to find out what I may have broken by removing this library jar file.Burnie
T
0

I just opened generated jar file with winrar. And deleted SIGNINGC.SF file in META-INF folder

Transmitter answered 25/8, 2022 at 7:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.