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

Mert Serimer
  • 1,217
  • 2
  • 16
  • 38
  • What is the output in the command line when you run it as `java -jar …`? – CrazyCoder Jul 17 '17 at 23:02
  • @CrazyCoder Could not find main class or load – Mert Serimer Jul 18 '17 at 05:25
  • 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](https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000120864--SOLVED-How-to-turn-a-mixed-Kotlin-Java-project-with-a-Kotlin-file-as-main-class-into-a-JAR-?page=1#community_comment_115000144030). – CrazyCoder Jul 18 '17 at 12:21
  • @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? – Mert Serimer Jul 18 '17 at 13:35
  • What's inside the generated jar manifest file? Does it specify the correct main class? – CrazyCoder Jul 18 '17 at 13:35
  • Yes it is, see new image on the question pls. – Mert Serimer Jul 18 '17 at 13:38
  • Do you have this class in the jar? What's the source structure? Show this main class in the editor and the project view. – CrazyCoder Jul 18 '17 at 13:40
  • 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? – Mert Serimer Jul 18 '17 at 13:44
  • Please share the [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve), otherwise it's hard to tell what's wrong, sorry. – CrazyCoder Jul 18 '17 at 13:46
  • 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. – Mert Serimer Jul 18 '17 at 13:47
  • 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. – CrazyCoder Jul 18 '17 at 13:48
  • For example, [see here](https://stackoverflow.com/questions/45153017/intellij-project-executable-not-doing-anything#comment77276558_45153017), user didn't specify the correct file name. There could be also something else that is hard to spot from the screenshots. – CrazyCoder Jul 18 '17 at 13:50
  • https://www.dropbox.com/s/dckwabbbod6n8rz/LdapTool.zip?dl=0 can you look at it if you have time. Thanks – Mert Serimer Jul 18 '17 at 13:56
  • 1
    `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. – CrazyCoder Jul 18 '17 at 14:12

2 Answers2

11

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.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 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) – Mert Serimer Jul 18 '17 at 14:41
  • 1
    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](http://i.imgur.com/JEFln4h.png). – CrazyCoder Jul 18 '17 at 14:43
  • @CrazyCoder how I can find which jar causing the problem? – KostasC May 04 '21 at 15:50
  • 1
    @KostasC extract the jars and see if there are `*.SF/*.RSA` files inside. – CrazyCoder May 04 '21 at 20:59
  • 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. – Gary Robottom Jan 17 '22 at 05:31
0

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

Procrastinator
  • 2,526
  • 30
  • 27
  • 36
garawaa garawaa
  • 154
  • 1
  • 6