8
回答
如何让java项目连同mysql数据库一起打包成可安装的文件,可以在其他没有JVM的电脑上运行??
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   
怎么把数据库打包进去,我用Eclipse打包之后,数据库的驱动包是打包进去了的,然后我生成了exe。在我自己的电脑上可以运行,没有问题,可是传给另一台电脑之后,就无法连接数据库了,数据无法显示。错误提示如下:

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:951)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4600)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1328)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2395)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2428)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2213)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at util.Connect.getConnection(Connect.java:38)
at dao.DecodingCardDao.queryCardList(DecodingCardDao.java:59)
at service.DecodingCardService.InputList(DecodingCardService.java:120)
at foreground_pkg.Main.<init>(Main.java:332)
at foreground_pkg.Main.main(Main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.exe4j.runtime.WinLauncher.main(Unknown Source)
java.lang.NullPointerException
at dao.DecodingCardDao.queryCardList(DecodingCardDao.java:65)
at service.DecodingCardService.InputList(DecodingCardService.java:120)
at foreground_pkg.Main.<init>(Main.java:332)
at foreground_pkg.Main.main(Main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.exe4j.runtime.WinLauncher.main(Unknown Source)

举报
云sf
发帖于3年前 8回/4K+阅

以下是问题补充:

  • @云sf :没有把JDK打进去,只把jre和导出的jar文件一起生成exe文件,但是没有成功,我用的是exe4j导出exe文件 我写的java程序里有数据库,我想的是如何连数据库中的数据一起生成exe文件,这样程序才可以在任何电脑上运行。 (3年前)
顶部