Error: Failed to load main-class manifest attribute from
When I am installing mysql-connector-java-5.1.15-bin on my PC, it gives me an开发者_运维知识库 error such as: failed to load main-class manifest attribute from
. Please can you tell me what should I do to remove this error? I'm not able to do anything without mysql-connector-java-5.1.15-bin, so please tell me as soon as possible.
It sounds like you are trying to run the JAR file as if it is an executable JAR file (either by double-clicking on it or running it with a command like java -jar mysql-connector-...jar
).
That's not what you are supposed to do with this JAR file. You just need to add it to the classpath of your project; don't try to unpack it or run it. It doesn't contain an installation program.
Background information:
Executable JAR files contain a META-INF/MANIFEST
file that contains attributes such as Main-Class
that tell Java what the class to run is when you run the JAR file. If the JAR file doesn't contain a manifest file, or contains a manifest file that doesn't have a Main-Class
attribute, then it is not an executable JAR file.
Two questions come up: 1) Is mysql-connector-java supposed to have a main class? 2)how are you trying to install it?
1) No. It it only contains JDBC classes for interacting with mysql. 2) since you get main-class attribute errors you seem to be double clicking on a jar file.
To be able to use it you have to add the jar file to your classpath.
精彩评论