简体   繁体   中英

Java mysql Error: Could not find or load main class lib\mysql-connector-java-5.1.25-bin.jar

My screen:

http://gyazo.com/b5e94029c8356c693f8ce51bed98f97a.png


And Lib folder:

http://gyazo.com/a521f4b3bf3b1623fd3cc2ec6aa94705.png

This is my run.bat:

@echo off
title Tracer
"C:\Program Files (x86)\Java\jdk1.7.0\bin\java"  -Xmx256m -cp bin; lib\mysql-connector-java-5.1.25-bin.jar Mains
pause

Mains.java is located in src, and is findable.

What is the problem?, Trying to install mysql for the first time!

Your -cp argument needs to be without spaces. Change

-cp bin; lib\mysql-connector-java-5.1.25-bin.jar

to

-cp bin;lib\mysql-connector-java-5.1.25-bin.jar

The error message indicated that your class path was treated as just "bin;" and the other part (the path to the jar) was treated as the class to run.

Shells and the Windows command prompt usually treat spaces as separators between arguments, which is why removing the space is recommended here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM