Home Help Center

Bad path element for Java

myrosiamyrosia Member Myroslava DzikovskaOrganization: University of EdinburghProject: tutorial dialogue system ✭✭
When I am compiling our ice programs with java 1.6, I am constantly getting the warnings about bad elements in the path:

warning: [path] bad path element "/opt/ICE/Ice-3.3.1/java/lib/db.jar": no such file or directory

This path is definitely not on my classpath. The best I can tell, it is being added to classpath in Ice.jar. While it is harmless in principle, it makes it more difficult to see the valid warnings, and even more so when I am trying to help other team members to get their machines configured.

I read the INSTALL file for java, and checked config/build.properties. There is nothing that seems relevant there. Where can I fix this problem?

Thanks,

Myrosia

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi
    When I am compiling our ice programs with java 1.6, I am constantly getting the warnings about bad elements in the path:

    warning: [path] bad path element "/opt/ICE/Ice-3.3.1/java/lib/db.jar": no such file or directory

    This path is definitely not on my classpath. The best I can tell, it is being added to classpath in Ice.jar.
    Ice.jar doesn't add classpath entries to your projects, most probably you have add a wrong path in your build system.
    I am trying to help other team members to get their machines configured
    The easy will be to use one of the supported platforms and use ZeroC binary packages. See here for a list of supported platforms. And check the eclipse plug-in it made Ice java development easy.
    I read the INSTALL file for java, and checked config/build.properties. There is nothing that seems relevant there

    config/build.properties is only relevant to build Ice from sources, this doesn't affect your projects.

    Bests,
    José
  • myrosiamyrosia Member Myroslava DzikovskaOrganization: University of EdinburghProject: tutorial dialogue system ✭✭
    xdm wrote: »
    Ice.jar doesn't add classpath entries to your projects, most probably you have add a wrong path in your build system.

    That is definitely not the case for me. We use make (even for Java), and specify the classpath explicitly on the command line. My CLASSPATH environment variable is empty, and the java command being executed by make is

    javac -classpath /opt/ICE/Ice-3.3.1//java/lib/Ice.jar:/::/usr/share/java/xalan-j2.jar: -deprecation -encoding iso-8859-1 -Xlint AbstractLoggingAgent.java

    I dug around a bit, and the manifest file for Ice.jar specifies classpath which mentions db.jar. So it looks to me that Ice.jar is the source of the warnings.
    The easy will be to use one of the supported platforms and use ZeroC binary packages.

    It is not possible for me to install RPMs as root, so I have to compile from source.

    Myrosia
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    That is definitely not the case for me. We use make (even for Java), and specify the classpath explicitly on the command line. My CLASSPATH environment variable is empty, and the java command being executed by make is

    You are right

    Ice.jar Manifest file add the entries to the classpath
    <manifest>
       <attribute name="Built-By" value="ZeroC, Inc."/>
       <attribute name="Class-Path" value="db.jar db-${db.version}.jar /usr/share/java/db-${db.version}.jar ../db.jar"/>
    </manifest>
    

    See build.xml, you can remove the Class-Path and rebuild Ice.jar

    Regards,
    José
  • myrosiamyrosia Member Myroslava DzikovskaOrganization: University of EdinburghProject: tutorial dialogue system ✭✭
    OK, thanks, this worked for me.

    For the record, specifying an absolute path (as in /usr/share/java/db-${db.version}.jar) is not a good idea. The definition from Sun site says "The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs." So even an absolute path was treated as relative by Java, and caused warnings.

    I think it may be better in the future releases to just tell the users to add db.jar to their classpath - or otherwise keep only db.jar on the search list, and have the installer create a symbolic link to the correct location during installation (which is what I did manually on my system).

    Myrosia
  • ender8282ender8282 Member John HubbardOrganization: NSO/NSFProject: Telescope Control Systems
    xdm wrote: »
    Hi

    The easy will be to use one of the supported platforms and use ZeroC binary packages.

    Bests,
    José

    I got the same problem using the binaries distributed as part of Ubuntu 9.10

    By compiling under Ubuntu 9.10:
    javac -classpath /usr/share/java/Ice.jar -Xlint:all HelloWorld.java
    I got:
    warning: [path] bad path element "/usr/share/java/db.jar": no such file or directory
    warning: [path] bad path element "/usr/share/java/db-4.6.21.jar": no such file or directory
    warning: [path] bad path element "/usr/share/java/usr/share/java/libdb4.6-java.jar": no such file or directory
    warning: [path] bad path element "/usr/share/java/../db.jar": no such file or directory
    4 warnings

    javac -version
    javac 1.6.0_20

    I am pretty sure that this warning affects everyone but most people don't see it because they don't compile with -Xlint:all. A workaround is to switch -Xlint:all to -Xlint:all,-path. This suppresses the warning but will also suppress any actual problems with your build path.
Sign In or Register to comment.