classpath, libs

Declare depended jar libraries in configuration file


Introduction

These two configure items are both to add depended jar files into java classpath.

The difference between 'classpath' and 'libs' is that, 'classpath' is to specify jar files, while 'libs' is to specify a directory which contains jar files.


classpath

You can use one or more 'classpath' items in one configuration file.

Each 'classpath' item can be followed by one or more, absolute or relative jar file paths. If there are more than one jar file paths after a 'classpath', use ';' as separator on Windows, use ':' as separator on Linux. For example:

classpath ./classes
classpath ./lib/a.jar
classpath lib/b.jar;lib/c.jar

classpath *.jar[since V2.1.6]

Since V2.1.6, it is supported to use wildcard (*, ?) in the filename, to specify more than one jar files at a time. For example:

classpath *.jar
classpath lib/*.jar
classpath ../*/classes/

libs

Configure item 'libs' is to specify a directory, in which all jar files will be added to java classpath.

You can use one or more 'libs' items in one configuration file. Each 'libs' item can be followed by one directory only. For example:

libs ./lib

All jar files in 'lib' directory will be added to java classpath, it is equivalent to:

classpath ./lib/a.jar;./lib/b.jar;./lib/c.jar

Configure Assistant

You can configure the classpath with the help of Configure Assistant.

Comments

Config classpath based on execution machine's env vars

It seems that if I configure the classpath using an environment variable (e.g. %MY_PATH%/example.jar) it uses the MY_PATH environment variable as defined on the machine on which I build the exe. Is there a way to configure it so that when the exe is running on some other host machine it uses its environment? Thanks!

Excluding jars from libs

Any way to exclude some .jar when i use libs parameter ?

Excluding jars from libs

Why not create a separate libs folder and only add those jar files needed within the folder? 

Thanks for your message.

Thanks for your message. Right now, there is no syntax defined to exclude jar files from 'libs'.

Any suggestions about syntax of 'libs' to exclude some jar files?

Add new comment