简体   繁体   English

使用launch4j将ojdbc包含到.exe中

[英]Including ojdbc into .exe with launch4j

I have a REALLY simple app, that helps in repetitive tasks concerning script executions. 我有一个非常简单的应用程序,可以帮助执行有关脚本执行的重复任务。 No problem with that. 没问题。 App works perfectly in eclipse. 应用在Eclipse中完美运行。

I use ojdbc14.jar to work with my Oracle DB. 我使用ojdbc14.jar与我的Oracle DB一起工作。

Now, I wanted to create an exe file in order to distribute this little app amongst team mates, but the problem is, that when I run my app from .exe, there seems to be no connection with DB at all. 现在,我想创建一个exe文件,以便在队友之间分发这个小应用程序,但是问题是,当我从.exe运行我的应用程序时,似乎根本没有与数据库的连接。

I am using maven and launch4j in order to pack my app into an exe, and maven-shade-plugin. 我正在使用maven和launch4j以便将我的应用程序打包到exe和maven-shade-plugin中。

Here is my pom.xml: 这是我的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> 

Here is my MANIFEST.MF 这是我的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

And here is my really simple project structure: 这是我真正简单的项目结构:

PRJCT

Searched the internet to see if I could get some answers, but questions from people getting the same problems weren't answered. 在互联网上搜索我是否可以得到一些答案,但是也遇到了同样问题的人们的问题。

Any ideas on why this might not be working? 关于为什么这可能行不通的任何想法?

If my question isn't clear or I'm missing any details, please let me know how I can improve my question. 如果我的问题不清楚或缺少任何详细信息,请让我知道如何改进我的问题。

Thanks in advance. 提前致谢。

Few Comments and answers: (1) ojdbc14.jar is very old. 很少有评论和答案:(1)ojdbc14.jar很旧。 What is the version of your Oracle database? 您的Oracle数据库是什么版本? Can you use the latest JDBC drivers? 您可以使用最新的JDBC驱动程序吗? ojdbc7.jar from 12.1.0.2 or 12.1.0.1 ? 来自12.1.0.2或12.1.0.1的ojdbc7.jar?

(2) Oracle JDBC drivers are not present in the public maven repository. (2)公共aven存储库中不存在Oracle JDBC驱动程序。 So, you will need to download JDBC drivers manually from OTN page 因此,您需要从OTN页面手动下载JDBC驱动程序

Guide to installing 3rd party Jars " for more information. 有关更多信息,请参见安装第三方罐子指南

mvn install:install-file \\ -Dfile=/lib/ojdbc7.jar \\ -DgroupId=com.oracle \\ -DartifactId=ojdbc7 \\ -Dversion=12.1.0.1 \\ -Dpackaging=jar \\ -DgeneratePom=true mvn install:安装文件\\ -Dfile = / lib / ojdbc7.jar \\ -DgroupId = com.oracle \\ -DartifactId = ojdbc7 \\ -Dversion = 12.1.0.1 \\ -Dpackaging = jar \\ -DgeneratePom = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM