Class Path

Set depended jar libraries in classpath


Introduction

Your java program may need other jar libraries when it runs. Jar2Exe supports to pack depended jar files into exe file, those embedded jar files are included in classpath already. For jar files outside of generated exe file, it is supported to set 'class path' by many ways:

  • From environments CLASS_PATH and CLASSPATH
  • From a configure item 'classpath' in configuration file to specify one or more 'jar files'
  • From a configure item 'libs' in configuration file to specify a 'directory' which contains jar files

Environments CLASS_PATH and CLASSPATH

Generated exe will add jar libraries in environments CLASS_PATH and CLASSPATH into java classpath.

If you don't want your generated exe to use jar libraries in environments CLASS_PATH and CLASSPATH, you can use a 'export' configure item to overwrite the environments.

  • See export page for how to set environments.

Configure Item 'classpath'

You can use a configure item 'classpath' in configuration file to declare depended jar libraries.

Configure item 'classpath' should be followed by a path to jar file, or a directory which contains ".class" files.


Configure Item 'libs'

If you have too many jar files to add to classpath, you can use configure item 'libs' instead of 'classpath'.

Configure item 'libs' points to a directory, and generated exe will add all jar files in the directory to classpath, while if 'classpath' points to a directory, it means to add the directory itself to classpath.

 

Add new comment