Click here to Skip to main content
16,020,673 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi all

i have a target app written in Java.
i want to call one of its functions.
im using Intellij Idea.
i imported its dependencies.
wrote a few lines of code and till now, i have two problems.
1. i get:
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

and i fix this problem manually by removing 'META-INF/*.RSA' 'META-INF/*.DSA' files within the jar.
i want to know why this problem rises and how can i fix it in the proper way.

2. i don't know how to handle dependencies. for example when i want to call log4j, i get the "NoClassDefFoundError" exception.
i solved by adding log4j classes into the compiled jar file and it fixed.
clearly dependencies are not found. i tries -cp to no avail.

What I have tried:

googling:
i found some ant/gradle scripts but i don't know where to put them.
for now just manually modifying the compiler jar file for it to work.
Posted
Updated 8-Jan-23 22:46pm

1 solution

1. See the discussion at https://stackoverflow.com/questions/34855649/invalid-signature-file-digest-for-manifest-main-attributes-exception-while-tryin[^].

2. The log4j library is not part of a the standard Java libraries, so you need to include it in the jar file, or add its location to the LD_LIBRARY_PATH environment variable. The jvm needs to know where to finds it at run time.
 
Share this answer
 
Comments
reverser69 9-Jan-23 4:50am    
i already came upon the link you sent. i don't know where to place that code snippet! (absolute java beginner)
[no name] 9-Jan-23 5:18am    
Sorry, I have not used signed jar files. I suggest you avoid the more advanced subjects until you are more experienced with the basics.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900