Search code examples
javawinrun4j

Winrun4j: Exceeded maximum classpath size


My project has many dependencies and I tell winrun4j to include all of them by setting

classpath.1=D:\lib\*.jar

in the ini file.

The service log is telling me that that winrun4j is expanding classpath and generating a classpath:

[info] Expanding Classpath: D:\lib\*.jar
[info] Expanding Classpath: D:\lib\activation-1.1.1.jar
[info] Expanding Classpath: D:\lib\activemq-client-5.10.2.jar
[...]
[...]many, many other libs here
[...]
[warn] Exceeded maximum classpath size
[info] Generated Classpath: D:\lib\activation-.1.1.jar;D:\lib\activemq-client-5.10.2.jar;[...]

Why is winrun4j generating a classpath like this? Shouldn't it be enough to just take

D:\lib\*.jar

?

Any ideas for a workaround to get the service running with that many dependencies?


Solution

  • It is winrun4j problem known for a long time, not solved and discussed here :

    Exceeds maximum classpath length #59

    https://github.com/poidasmith/winrun4j/issues/59

    and here :

    Add an INI option to disable classpath glob expansion #67

    https://github.com/poidasmith/winrun4j/issues/67

    Unfortunately, you have not many possibilities. As the issue 59 suggests, you could set the working directory to be the module directory. You could spare some characters.

    D:\lib\activation-.1.1.jar; would become lib\activation-.1.1.jar;. You could also check that all dependencies are needed.

    If it not enough, you should seriously look for a alternative such as JSmooth or Launch4J.