简体   繁体   中英

Generating .jar using Java 1.7 with Eclipse and SQL Server 2012 database with Windows authentication

I am using Java 1.7 Desktop application with Eclipse and SQL Server 2012 database with Windows authentication. When I run through eclipse works correctly. The problem is when I try to generate a .Jar. The application works correctly but when I am going to do some query on the database the application stop working. I wonder what are the correct settings I have to do on the machine (the same machine) and time to generate. Jar, thanks.

Got this error by compiling in the prompt:

C:\Users\jean>java -jar C:\Users\jean\Desktop\Jean\aee.jar
Jan 15, 2014 8:29:34 AM com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit>
AdvertÛncia: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java
.library.path
com.microsoft.sqlserver.jdbc.SQLServerException: Esse driver nÒo estß configurad
o para autenticaþÒo integrada. ClientConnectionId:02155bdf-555d-4b59-8933-a98091
48a83f
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerC
onnection.java:1667)
        at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>

My problem is solved by just adding the .dll in the same directory of the .jar.

I'm guessing you use some libraries for your project. If you export a jar from Eclipse, it doesn't package those libraries into that jar automatically. As an easy way out you coul'd use the Fat Jar Plugin . It worked fine for me in the past.

Ultimately you want to use a build and dependency management tool like Maven .

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