简体   繁体   中英

External jar Files in Java

Im trying to import external jar files onto the JRE system library in Java Eclipse, but it creates a new file path called Referenced Libraries and imports it there, which is not what I want. I am trying to do this to connect to the database, This is the code I have:

database()
{
    try{

        Class.forName("com.mysql.jdbc.Driver");
         con=DriverManager.getConnection("jdbc:mysql://localhost/white-house","root","");
                    stmt=con.prepareStatement("select * from staff where username=? and password=?");



       }

Any suggestion please..

右键单击项目->构建路径->添加外部档案...,然后选择您的jar文件

尝试右键单击您的项目并选择属性,然后可以在其中添加库-Java构建路径-添加jar。

在Eclipse Package Explorer中,右键单击您的项目,然后选择Build Path,Configure Build Path,然后单击Libraries选项卡和Add External Jars按钮。

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