Could not find or load main Class on JAR executing

强颜欢笑 提交于 2019-11-28 11:35:29

Open your jar file with WinRAR or a similar program. Then go to the META-INF folder and open the MANIFEST.MF. Make sure the property "Main-Class: your.class.path" is correct.

So,here comes an error to the problem---why have you mentioned con = DriverManager.getConnection(...); in your code?

And hence your code is catching SQL Exception!!! This is the source of error :-

public boolean userEnterCondition(char[] pass) {
Connection con;
PreparedStatement preparedStatement;
ResultSet resultSet;
String query = "Select * from users";
String password = null;
try {
    Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection(...);     //error in this line

................. and so on.

Replace it with

con =DriverManager.getConnection("jdbc:mysql://localhost/Library?" +
                               "user=yourusername&password=yourpassword");

I hope this helps.If still getting error,please comment below!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!