2017-07-10 6 views
0

firebaseに書き込むプログラムを作成し、Netbeans IDEで実行するとプログラムが正常に動作しますが、.JARファイルにビルドするとNetbeansプロジェクトでFirebaeValueEventListenerが原因でjniエラーが発生するのはなぜですか?

enter image description here

がHERESに私のポンポンのXMLは、それは場合に役立ちます:

<?xml version="1.0" encoding="UTF-8"?> 
<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>com.FUJCode</groupId> 
<artifactId>climate2.0</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>jar</packaging> 
<dependencies> 
    <dependency> 
     <groupId>com.google.firebase</groupId> 
     <artifactId>firebase-admin</artifactId> 
     <version>5.2.0</version> 
    </dependency> 
</dependencies> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <maven.compiler.source>1.8</maven.compiler.source> 
    <maven.compiler.target>1.8</maven.compiler.target> 
</properties> 
<name>UsageMoniter</name> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <version>2.4</version> 
      <configuration> 
       <archive> 
        <manifest> 
         <addClasspath>true</addClasspath> 
         <mainClass>Climate</mainClass> 

        </manifest> 
       </archive> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

イムかなり私はこのメッセージを取得したjarファイルを実行します確かに私はすべての依存関係を得て、何が間違っているのか分からない。

これ以上の情報が必要な場合は、私に知らせていただき、何か助けていただければ幸いです。 多くのおかげで、

トム

EDIT

enter image description here

EDIT 2

ここではプロジェクトフォルダ内には、依存関係のフォルダ内のすべてのfirebaseものを示しています

あなたが必要なサードパーティの成果物をコピーする必要があり

enter image description here

しかし、あなたがファイルを見るときに見られるすべきfirebaseビジネスはありません、何を言ってわからないイム...

enter image description here

答えて

0

あなたのプロジェクトに、例えばあなたのpom.xmlを拡張することによって:

<build> 
    <plugins> 
    ... 
    <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-dependency-plugin</artifactId> 
     <executions> 
     <execution> 
      <phase>install</phase> 
      <goals> 
      <goal>copy-dependencies</goal> 
      </goals> 
      <configuration> 
      <outputDirectory>${project.build.directory}/lib</outputDirectory> 
      </configuration> 
     </execution> 
     </executions> 
    </plugin> 
    ... 
    </plugins> 
</build> 

次に、あなたが例えば、それを起動するときに、アプリケーションのクラスパスにサードパーティの依存関係を追加する必要があります。

java.exe -cp "climate2.0-1.0-SNAPSHOT.jar;lib/*" -jar climate2.0-1.0-SNAPSHOT.jar 

かの助けを借りてuberjarを作成しますhere

これは、プロジェクトをビルドするときに、すべての依存関係を含む別のjarファイルを作成します。

+0

私はこのコマンドをコピーして貼り付けると同じエラーが出るようですが、ここで私が愚かであれば私を許してください...私は自分の投稿の編集にスクリーングラブを投稿しました。 –

+0

自分のアンカーを更新しました。そのように試してみて、必要なアーティファクト(Google Firebase)がターゲットフォルダ内にあることを確認してください。 – funfried

+0

私の無能さを忍耐してくれてありがとう、本当に感謝しています。私の人工物がどのように配布されているのか、それが私たちに何らかの用途のものである場合を示しています。 –

関連する問題