Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to set multiple jars in java classpath?

NickFNickF USAMember Posts: 132

Is it possible to include multiple jars in java classpath? If so, can someone please explain?

Tagged:

Comments

  • DavidMDavidM USAMember Posts: 342

    Please check this thread.

  • robertgalprobertgalp uaeMember Posts: 2

    Wild cards were introduced from Java 6. Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.

    java -cp "lib/*" -jar %MAINJAR%

    If you need only specific jars, you will need to add them individually. The classpath string does not accept generic wildcards like Jar*, .jar, hiber etc.

    Example

    The following entry does not work:

    java -cp "Halo.jar;lib/*.jar" ni.package.MainClass

    Correct entry is :

    java -cp "Halo.jar;lib/*" ni.package.MainClass

    More about....Java Classpath

    Robert

Sign In or Register to comment.