Menu

Confusion building class path if multiple versions of same jar

Help
johntdow
2013-07-05
2013-07-23
  • johntdow

    johntdow - 2013-07-05

    Suppose there are these two files in a folder from which the lap file says to get groovy-all:
    groovy-all-1.7.5.jar
    groovy-all-2.1.5.jar
    I need it to find 2.1.5 and ignore 1.7.5 but don't know how to do that. If I specify 2.1.5, it seems that janel strips off 2.1.5 and takes the first instance (ie 1.7.5, with the lower version number).

     
  • Timothy Kil

    Timothy Kil - 2013-07-06

    Hello,

    Janel will not strip off version numbers. I suspect both of your groovy jars are in the classpath and the classloader just happens to be loading the 1.7.5 first. You may have to specify each jar file you want in your classpath instead of having Janel add an entire directory to the classpath. To add individual jars to the classpath you could use -Djava.class.path.

    Tim

     
  • johntdow

    johntdow - 2013-07-12

    I just did a test.

    The lap file has one reference to groovy, namely groovy-all-2.1.5;

    The lib folder has
    D:\devj\ssp\lib\groovy-all-1.7.5.jar
    D:\devj\ssp\lib\groovy-all-2.1.5.jar

    The resulting classpath (I had the program display the system property java.class.path)
    has
    ....\lib\groovy-all-1.7.5.jar
    ....\lib\groovy-all-2.1.5.jar

    Why both versions in the class path, when the lap file identifies just one?

    John

     
  • Timothy Kil

    Timothy Kil - 2013-07-12

    Hi John,

    Would you email me your lap file? I will try to reproduce this issue. One idea may be that an environment variable CLASSPATH is adding your lib directory to the classpath.

    Thanks,
    Tim

     
  • johntdow

    johntdow - 2013-07-15

    lap file attached

     
  • Timothy Kil

    Timothy Kil - 2013-07-19

    Hi John,

    A couple observations. Did you mean to put a collection of paths, not jars in the classpath? The following would be considered by Java to be paths.
    iText;^ // iText
    commons-beanutils;^ // JasperReports
    commons-collections;^ // JasperReports
    commons-digester;^ // JasperReports
    commons-logging;^ // JasperReports
    groovy-all-2.1.5;^ // JasperReports
    jasperreports;^ // JasperReports
    jasperreports-fonts;^ // JasperReports
    jdt-compiler;^ // JasperReports

    Also if there are any groovy jars in ....\lib they will be added to the classpath due to the following line in the lap file.
    janel.classpath.jars.dir=....\lib

    Tim

     
  • johntdow

    johntdow - 2013-07-22

    The primary problem was the use of janel.classpath.jars.dir. That caused it to find files without regard to specified version numbers. However, I think I was using that because when I started using Janel, I had problems enumerating all the jar files with continuation lines. (I had previously been using another launcher which permitted me to annotate lines in the list of jars using "//" as an end of line comment. Janel doesn't permit this. Nor can you use "#" for an end of line comment. However, you can intersperse blank lines and lines beginning with "#" in the list, and that suffices and solves my problem. Here are the top several lines of my file to illustrate.

    SWCue configuration file for Janel launcher

    -Djava.class.path=swcue.jar;dowlib.jar;^

    iText

    ....\lib\iText-2.1.7.jar;^

    JasperReports

    ....\lib\commons-beanutils-1.8.2.jar;^
    ....\lib\commons-collections-3.2.1.jar;^

    Thanks for the help.

    John

     
  • Timothy Kil

    Timothy Kil - 2013-07-23

    You're welcome John! Yes, Janel doesn't support for a comment anything more than a # at the beginning of a line in the lap file. Possibly at a major point release of Janel I will rethink that.

    Tim

     
MongoDB Logo MongoDB