2012-12-01 57 views
4

我在java中完成了一個項目,即使用javaCV庫進行運動檢測。當我從NetBeans調試代碼它正常工作。它檢測動作併發出警報,發送郵件等。但是當我清理並構建代碼時,獲取的.jar文件未加載網絡攝像機。 當我打開.jar文件時,它顯示一個空白畫布。 我可以給我的另一個信息是,當我清理& bulid時,o/p顯示一些警告,如不推薦使用的API。成功清理並構建JavaCV後無法運行


init: 
deps-clean: 
Created dir: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build 
Updating property file: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\built-clean.properties 
Deleting directory C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build 
clean: 
init: 
deps-jar: 
Created dir: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build 
Updating property file: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\built-jar.properties 
Created dir: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\classes 
Created dir: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\empty 
Created dir: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\generated-sources\ap-source-output 
Compiling 35 source files to C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\classes 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:7: warning: String is internal proprietary API and may be removed in a future release 
import com.sun.org.apache.xpath.internal.operations.String; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:17: warning: AudioPlayer is internal proprietary API and may be removed in a future release 
import sun.audio.AudioPlayer; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:18: warning: AudioStream is internal proprietary API and may be removed in a future release 
import sun.audio.AudioStream; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:12: warning: AudioStream is internal proprietary API and may be removed in a future release 
import sun.audio.AudioStream; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:32: warning: String is internal proprietary API and may be removed in a future release 
    String t; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:36: warning: String is internal proprietary API and may be removed in a future release 
    static String user; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:287: warning: AudioStream is internal proprietary API and may be removed in a future release 
      AudioStream as = null; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:300: warning: AudioStream is internal proprietary API and may be removed in a future release 
       as = new AudioStream(in); 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:312: warning: AudioPlayer is internal proprietary API and may be removed in a future release 
      AudioPlayer.player.start(as); 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\NewJFrame1.java:502: warning: String is internal proprietary API and may be removed in a future release 
    public static void main(String args[]) { 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:44: warning: AudioStream is internal proprietary API and may be removed in a future release 
    AudioStream as; 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:109: warning: AudioStream is internal proprietary API and may be removed in a future release 
     as = new AudioStream(in); 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:220: warning: AudioPlayer is internal proprietary API and may be removed in a future release 
         AudioPlayer.player.start(as); 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:232: warning: AudioStream is internal proprietary API and may be removed in a future release 
         as = new AudioStream(in); 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:281: warning: AudioPlayer is internal proprietary API and may be removed in a future release 
      AudioPlayer.player.stop(as); 
C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\src\projectlogin\operation.java:286: warning: AudioPlayer is internal proprietary API and may be removed in a future release 
     AudioPlayer.player.stop(as); 
Note: Some input files use or override a deprecated API. 
Note: Recompile with -Xlint:deprecation for details. 
Note: Some input files use unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details. 
16 warnings 
Copying 15 files to C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build\classes 
compile: 
Created dir: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\dist 
Copying 1 file to C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\build 
Copy libraries to C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\dist\lib. 
Building jar: C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\dist\projectlogin.jar 
To run this application from the command line without Ant, try: 
java -jar "C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\dist\projectlogin.jar" 
jar: 
BUILD SUCCESSFUL (total time: 7 seconds) 
+0

您確定NetBeans和您的獨立JAR文件使用相同的JDK,相同版本的OpenCV等嗎? –

+0

@SamuelAudet:是的。 JDK1.7&openCV2.2 –

+0

好吧,所以請再次嘗試使用最新版本:JavaCV 0.3和OpenCV 2.4.3,並讓我知道這是否有效。 –

回答

1

輸出表明您應該通過命令行java -jar "C:\Users\Anooj\Documents\NetBeansProjects\projectlogin\dist\projectlogin.jar

運行它,如果你從dist目錄中運行它,它會包括項目所需的庫。我懷疑你正在嘗試運行沒有關聯庫的項目。

+0

。庫文件夾位於我的dist文件夾中。但是,當我打開jar文件時,GUI除了相機之外都能正常工作。無需捕捉即可獲得空白畫布。我試圖從命令行運行它,但問題仍然存在。是否由於我的C驅動器(OS驅動器)中的OpenCV庫出現任何錯誤? –