2017-07-31 3 views
0
Exception in Application start method 
java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:497) 
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389) 
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:497) 
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) 
Caused by: java.lang.RuntimeException: Exception in Application start method 
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917) 
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$156(LauncherImpl.java:182) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.lang.NoClassDefFoundError: com/itextpdf/text/DocumentException 
    at java.lang.Class.getDeclaredConstructors0(Native Method) 
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) 
    at java.lang.Class.getConstructor0(Class.java:3075) 
    at java.lang.Class.newInstance(Class.java:412) 
    at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:51) 
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:927) 
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971) 
    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220) 
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744) 
    at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124) 
    at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104) 
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097) 
    at passwordProtector.Main.start(Main.java:29) 
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(LauncherImpl.java:863) 
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(PlatformImpl.java:326) 
    at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294) 
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) 
Caused by: java.lang.ClassNotFoundException: com.itextpdf.text.DocumentException 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 25 more 

私のクラスパスへのリンクは、私は他の回答を見て、何の重複を持っていなかったhttp://imgur.com/W4ly7Qp あるので、私は、画像を投稿することはできません私はまた、ファイルがjarフォルダにあることを確認したので、なぜこのエラーが発生しているのか分かりません。 私はに起因する誤差取得しています:java.lang.NoClassDefFoundErrorがが:COM/itextpdf /テキスト/ DocumentException

この

は私のコードはまた

public class Main extends Application { 

    @Override 
    public void start(Stage primaryStage){ 
     Parent root = null; 
     URL url = getClass().getResource("/gui.fxml"); 
     System.out.println(url); 

     if(url==null){ 
      url = getClass().getClassLoader().getResource("gui.fxml"); 
      System.out.println(url); 
     } 
     try { 
      assert url != null; 
      root = FXMLLoader.load(url); 
     } catch (Exception e) { 
      System.out.println("Exception on FXMLLoader.load()"); 
      System.out.println(" * url: " + url); 
      System.out.println(" * " + e); 
      System.out.println("--------------------------------------------------------------------------------"); 
      e.printStackTrace(); 
     } 
     Stage stage = new Stage(); 
     assert root != null; 
     stage.setScene(new Scene(root)); 
     stage.setTitle("Password Protector"); 
     stage.show(); 
    } 


    /** 
    * @param args the command line arguments 
    */ 
    public static void main(String[] args) { 
      launch(args); 
    } 
} 

それは5.5.11と同じ機能を持っていないが、私は低いバージョンを使用することができる場合があるため、私はバージョン2.1.7を使用することはできません、それを呼び出している

+2

この画像を投稿しようとしているコードはどこですか?どのような文脈であなたはそれを –

+0

と呼んでいますかiTextのバージョンを5.xから2.1.7に変更しようとしましたか? –

+0

LibraryにDocumentException jarを追加しましたか? –

答えて

0

私の問題は、このリンクが出力をルートに置いたことを示しているので、出力をルートに抽出していないということでした。http://imgur.com/a/POx5j

関連する問題