Debug Your App - warning: [path] bad path element "some/path/file.jar": no such file or directory
This page shows errors where a bad path element warning is thrown and how to fix them.
Table of Contents
Explanation
This error occurs during compilation and can be confusing since the listed
JAR files may not exist in your project, or anywhere in your file system. The path however, is the path where all your project's other
JAR files are located.
Example
warning: [path] bad path element "/path/to/libs/folder/log4j.jar": no such file or directory
warning: [path] bad path element "/path/to/libs/folder/log4j-core.jar": no such file or directory
warning: [path] bad path element "/path/to/libs/folder/struts-legacy.jar": no such file or directory
...
Cause
The listed jar files are referenced in the
META-INF/MANIFEST.MF file in certain jar files in your project. They show dependancy information that was used at the time the
JAR file was constructed, using the MANIFEST.MF extension system.
The files may or may not be required by the JAR file that is referencing them.
The warning only shows when Xlint is enabled by the compiler.
How to fix
- You can ignore (disable) these warnings by using the -Xlint:-path command line parameter for javac, or <compilerarg value="-Xlint:-path "/> in ANT.
- You can fix the problem by including the JAR files that the compiler warns about. If the JAR files are really required, this will prevent ClassNotFound exceptions from occurring at runtime. However, if the JAR files are not required, this will just bloat your application.