我有一个非常简单的应用程序,它有助于执行有关脚本执行的重复性任务。没有问题。 App在eclipse中完美运行。将ojdbc包含到带有launch4j的.exe文件中
我使用ojdbc14.jar来处理Oracle数据库。
现在,我想创建一个exe文件,以便在队友中分发这个小应用程序,但问题是,当我从.exe运行我的应用程序时,似乎根本没有与数据库的连接。
我正在使用maven和launch4j,以便将我的应用程序打包成exe文件和maven-shade-plugin。
这里是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>miniApp</groupId>
<artifactId>miniApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc14.jar</systemPath>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.7.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>miniApp.App</mainClass>
</transformer>
</transformers>
</configuration>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar</jar>
<outfile>${project.build.directory}/miniApp.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classPath>
<mainClass>miniApp.App</mainClass>
<preCp>anything</preCp>
</classPath>
<icon>src/Settings.ico</icon>
<jre>
<minVersion>1.6.0</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
[![enter image description here][1]][1] <copyright>2012 hasCode.com</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>${project.name}</productName>
<companyName>miniApp.com</companyName>
<internalName>miniApp</internalName>
<originalFilename>miniApp.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
这里是我的MANIFEST.MF
Manifest-Version: 1.0
Specification-Title: Oracle JDBC driver classes for use with JDK14
Sealed: true
Created-By: 1.4.2_14 (Sun Microsystems Inc.)
Implementation-Title: ojdbc14.jar
Specification-Vendor: Oracle Corporation
Specification-Version: Oracle JDBC Driver version - "10.2.0.4.0"
Implementation-Version: Oracle JDBC Driver version - "10.2.0.4.0"
Implementation-Vendor: Oracle Corporation
Implementation-Time: Sat Feb 2 11:40:29 2008
Name: oracle/sql/converter/
Sealed: false
Name: oracle/sql/
Sealed: false
Name: oracle/sql/converter_xcharset/
Sealed: false
这里是我的非常简单的项目结构:
搜索互联网,看看我能否得到一些答案,但来自人们的问题g同样的问题没有回答。
任何想法,为什么这可能不工作?
如果我的问题不清楚或者我错过了任何详细信息,请告诉我如何改进我的问题。
在此先感谢。
如果没有人可以帮助我,有人会告诉我另一种方法来实现我的目标吗?另一种工具?谢谢 –