exe4j

Exe created by Exe4j with external libs dependation


We are trying to wrap our jar file with exe4j to exe file. Our jar depends on several jar libraries stored in libs folder. We don't want to distribute jar file, only exe and jar libraries in libs folder. For execution of application we are using own JRE.

Here is the file structure of application:

/java 
/libs 
application.exe

In the project type, we are using "Jar in exe mode" option. Exe is generated but its execution failed. In errors.log I can see, that java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory If I add slf4j.jar to classpath, generated exe is bigger and there is another NoClassDefFoundError in error.log file.

If I try "Regular mode" and specify folder with external libs - application is working well. But to specify folder is not accessible for "Jar in exe mode".

Is there any way, to have exe which wraps jar file, and uses jar libraries which are stored in external libs folder, without manual specify them and pack them to the exe?


Solution

  • We don't want to distribute jar file, only exe and jar libraries in libs folder.

    The JAR file in the generated executable is not protected in any way, because it will be extracted to the %TEMP% directory when the executable is started. This is why you can just use the regular mode and put the JAR file in the lib directory.

    To protect the JAR file, use an obfuscator like proguard.