我在 Netbeans 7.3.1 上使用 fxml、hibernate 创建了一个 java fx 应用程序。在 Netbeans 中运行以及从 dist 文件夹运行 jar 文件时,它工作正常。数据库操作就好了。但我想以便携式形式将应用程序导出到另一个系统。所以我使用工具Wix和Inno 5创建了本机包。但生成的应用程序无法在我自己的系统或其他系统中运行。 运行应用程序时显示异常。我通过将数据库IP地址更改为localhost、127.0.0.1和我的物理IP来检查了几次。但没有工作。 我的java版本是Java 7 update 40(jdk1.7.0_40)
这是显示错误的屏幕截图的链接:https://i.sstatic.net/mDWly.jpg
我的build.xml包含
<target name="-post-jfx-deploy">
<fx:deploy width="${javafx.run.width}" height="${javafx.run.height}"
nativeBundles="all"
outdir="${basedir}/${dist.dir}" outfile="${application.title}">
<fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
<fx:resources>
<fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
</fx:resources>
<fx:info title="${application.title}" vendor="${application.vendor}"/>
</fx:deploy>
</target>
我的 hibernate cfg 文件包含
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sample?zeroDateTimeBehavior=convertToNull</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<mapping resource="entity/Sample.hbm.xml"/>
</session-factory>
</hibernate-configuration>
是否需要任何额外的配置才能使应用程序独立工作?
我已经修好了... 我需要做的就是在构建中包含 lib 文件夹......我的错。
哦,很高兴您找到了解决方案。