Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用数据库连接JAR构建.exe文件_Java_Swing_Launch4j_Antbuilder - Fatal编程技术网

Java 使用数据库连接JAR构建.exe文件

Java 使用数据库连接JAR构建.exe文件,java,swing,launch4j,antbuilder,Java,Swing,Launch4j,Antbuilder,谁能告诉我如何通过包含用于数据库连接的库jar文件来构建.exe文件?我有一个独立的应用程序,我正在使用Launch4j.exe生成器。jar to exe也可以用于数据库连接。 但是对于任何文件、jar和任何东西,您总是引用绝对路径。 因为exe可以在windows中的任何位置运行。 例如:如果您的exe有任何文件关联。 所以你必须选择一个固定的路径,你把所有的罐子和需要的文件放在那里。 在编码中,使用恒定绝对路径引用该文件。 例如:c:\ProgramFiles\your company\y

谁能告诉我如何通过包含用于数据库连接的库jar文件来构建.exe文件?我有一个独立的应用程序,我正在使用Launch4j.exe生成器。

jar to exe也可以用于数据库连接。 但是对于任何文件、jar和任何东西,您总是引用绝对路径。 因为exe可以在windows中的任何位置运行。 例如:如果您的exe有任何文件关联。 所以你必须选择一个固定的路径,你把所有的罐子和需要的文件放在那里。 在编码中,使用恒定绝对路径引用该文件。 例如:c:\ProgramFiles\your company\your productc:\Program files\your company\your product\your JAR等等。您的类路径引用了这个jars。因此,您的exe运行时没有任何相对路径问题。如果你使用任何安装程序,你的工作是非常容易的。示例高级安装程序。

让分发文件结构如下:
Let the distribution file structure is like this:

bin/launch4j.exe  
bin/config.xml  
bin/dist/app.jar  
bin/dist/lib/ojdbc6.jar

jar files in the lib directory can be included in the config file as below:

<launch4jConfig>
  ...........
  <chdir>./dist</chdir>
  ...........
  <classPath>
    ..........
    <cp>./lib/*.jar</cp>
    ..........
  </classPath>
  ...........
</launch4jConfig>
bin/launch4j.exe bin/config.xml bin/dist/app.jar bin/dist/lib/ojdbc6.jar lib目录中的jar文件可以包含在配置文件中,如下所示: ........... /区 ........... .......... ./lib/*.jar .......... ...........
非常感谢您的帮助!谢谢你的帮助!!