jpackage命令不在EXE安装程序中添加库

发布于 2025-02-10 06:58:58 字数 17688 浏览 3 评论 0原文

我正在尝试使用spire.doc / aspose.word在Javafx应用程序中操纵Word文件。当在日食或使用jar执行时,它可以很好地工作,但是当我使用jpackage命令进行EXE时,应用程序抛出 java.lang.noclassdeffounderror:com/spire/doc/document/document java.lang.classnotfoundexception:com.spire.doc.document

这是我正在使用的代码 主类(doc.docmain)

public class docMain extends Application {
@Override
public void start(Stage primaryStage) {
    FXMLLoader loader= new FXMLLoader();
    loader.setLocation(docMain.class.getResource("view/Interface.fxml"));
    
    try {
        VBox interf= (VBox)loader.load();
        Scene scene= new Scene(interf);
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

public static void main(String[] args) {
    launch(args);
}

}

interfacemap.class

public class interfaceM {
@FXML
private Button bouton;

public  void createTable(){
    File f= new File("C:/IOLS/createdTable.txt");
    if(!f.exists()) {
        System.out.println("creating the txt file");
        try {
            f.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    LineNumberReader fr;
    try {
        fr = new LineNumberReader(new FileReader(f));
        String str=fr.readLine();
        int number=0;
        
        System.out.println(f.length()+" Reading line: "+str);
        if(str!=null && !str.trim().equals("")) {
            number=Integer.valueOf(str);
            number+=1;
            System.out.println(number);
        }
        //fr.close();
            
        
        FileWriter fl= new FileWriter(f);
        System.out.println("Filewriter"+ number);
        fl.write(number+ "\n");
        fl.close();
        fr.close();
        System.out.println("-- creating tableWith spire --");
        System.out.println("I will create a doc");
        Document doc= new Document();
        
        System.out.println("Doc created - Add a section");
        Section section= doc.addSection();
        
        String[] header= {"Nom", "Prenom", "Age", "Nationalité"};
        String[][] data= {
                new String[] {"Kaneza","Belyse","32 ans", "Burundaise"},
                new String[] {"Kaitis", "Stephany", "24 ans", "Kenyanne"},
                new String[] {"Ndolbolo", "Yasolo", "30 ans", "Congolaise"},
                new String[] {"Kigeme", "Alphonsine", "65 ans", "Burundaise"},
                new String[] {"Kaneza","Belyse","32 ans", "Burundaise"},
                new String[] {"Kaitis", "Stephany", "24 ans", "Kenyanne"},
                new String[] {"Ndolbolo", "Yasolo", "30 ans", "Congolaise"},
                new String[] {"Kigeme", "Alphonsine", "65 ans", "Burundaise"}
        };
        
        System.out.println("Create the table");
        
        Table table= section.addTable(true);
        table.resetCells(data.length+1, header.length);
        
        TableRow row=table.getRows().get(0);
        row.isHeader(true);
        row.setHeight(20);
        row.setHeightType(TableRowHeightType.Exactly);
        row.getRowFormat().setBackColor(Color.GRAY);
        
        //add header
        
        for(int i=0; i<header.length; i++) {
            row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
            Paragraph p= row.getCells().get(i).addParagraph();
            p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
            p.appendText(header[i]);
        }
        
        //add rest
        
        for(int i=0; i<data.length; i++) {
            TableRow tableR=table.getRows().get(i+1);
            for(int j=0; j<data[i].length; j++) {
                tableR.getCells().get(j).addParagraph().appendText(data[i][j]);
            }
        }
        
        //save a file
        for(int i=0; i<5; i++)
            table.addRow();
        
        table.applyHorizontalMerge(data.length+1, 0, 3);
        
        table.applyVerticalMerge(2, data.length+2, data.length+5);
        
        //table.getRows().get(data.length+3).getCells().get(1).splitCell(3, 3);
        
        
        System.out.println("Save the file");
        doc.saveToFile("C:/IOLS/createdTable-"+number+".docx", FileFormat.Docx_2013);
        System.out.println("Saved");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    
}

}

fxml源文件

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.VBox?>

<VBox prefHeight="200.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8" 
xmlns:fx="http://javafx.com/fxml/1" fx:controller="doc.view.interfaceM">
<children>
  <Button fx:id="bouton" mnemonicParsing="false" onAction="#createTable" text="Button">
     <VBox.margin>
        <Insets left="174.0" right="174.0" top="90.0" />
     </VBox.margin>
  </Button>
 </children>

jpackage命令使用了

jpackage --module-path path-to-javafx-jmods --add-modules javafx.controls --add-modules javafx.fxml --input directory-with-jar  --name name --main-jar the-jar --main-class doc.docMain --win-shortcut --win-console.

我安装了该应用程序。执行后,我会得到此错误

3 Reading line: 11
12
Filewriter12
-- creating tableWith spire --
I will create a doc
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
    at [email protected]/javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
    at [email protected]/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown 
 Source)
    at 
 [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown 
 Source)
    at 
   [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
  Source)
    at 
    [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
  Source)
    at 
 
[email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown 
Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown     
  Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
    at [email protected]/javafx.scene.Node.fireEvent(Unknown Source)
    at [email protected]/javafx.scene.control.Button.fire(Unknown Source)
    at 
    [email protected]/com.sun.javafx.scene.
    control.behavior.ButtonBehavior.mouseReleased(Unknown 
   Source)
    at [email protected]/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown 
   Source)
    at 
   [email protected]/com.sun.javafx.event.CompositeEventHandler
   $NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
    at 
   [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown 
   Source)
    at 
    [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
   Source)
    at 
   [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
   Source)
    at 
 [email protected]/com.sun.javafx.event.CompositeEventDispatcher.
  dispatchBubblingEvent(Unknown Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
    at [email protected]/javafx.scene.Scene$MouseHandler.process(Unknown Source)
    at [email protected]/javafx.scene.Scene.processMouseEvent(Unknown Source)
    at [email protected]/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
    at 
    [email protected]/com.sun.javafx.tk.quantum.
    GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at 
   [email protected]/com.sun.javafx.tk.quantum.
    GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at [email protected]/com.sun.javafx.tk.quantum.
   GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
    at 
  [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown 
  Source)
    at [email protected]/com.sun.javafx.tk.quantum.
   GlassViewEventHandler.handleMouseEvent(Unknown Source)
    at [email protected]/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
    at [email protected]/com.sun.glass.ui.View.notifyMouse(Unknown Source)
    at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown 
   Source)
    at java.base/java.lang.Thread.run(Unknown Source)
   Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javafx.reflect.Trampoline.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at [email protected]/com.sun.javafx.reflect.MethodUtil.invoke(Unknown Source)
    at [email protected]/com.sun.javafx.fxml.MethodHelper.invoke(Unknown Source)
    ... 47 more
   Caused by: java.lang.NoClassDefFoundError: com/spire/doc/Document
    at doc.view.interfaceM.createTable(interfaceM.java:60)
    ... 58 more
   Caused by: java.lang.ClassNotFoundException: com.spire.doc.Document
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 59 more

,然后我认为jpackage没有导入spire.doc库。 我尝试更改spire.doc版本 / javafx版本 /我甚至使用了Aspose Word,但仍然存在相同的问题。感谢您的帮助。我很抱歉长时间。

I'm trying to use Spire.Doc / Aspose.word to manipulate word files in a JavaFx application. When executed in eclipse or using a jar , it works very well but when I make an exe using jpackage command, the app throws java.lang.NoClassDefFoundError: com/spire/doc/Document and java.lang.ClassNotFoundException: com.spire.doc.Document

Here's the code I'm using
The main class (doc.docMain)

public class docMain extends Application {
@Override
public void start(Stage primaryStage) {
    FXMLLoader loader= new FXMLLoader();
    loader.setLocation(docMain.class.getResource("view/Interface.fxml"));
    
    try {
        VBox interf= (VBox)loader.load();
        Scene scene= new Scene(interf);
        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

public static void main(String[] args) {
    launch(args);
}

}

InterfaceMap.class

public class interfaceM {
@FXML
private Button bouton;

public  void createTable(){
    File f= new File("C:/IOLS/createdTable.txt");
    if(!f.exists()) {
        System.out.println("creating the txt file");
        try {
            f.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    LineNumberReader fr;
    try {
        fr = new LineNumberReader(new FileReader(f));
        String str=fr.readLine();
        int number=0;
        
        System.out.println(f.length()+" Reading line: "+str);
        if(str!=null && !str.trim().equals("")) {
            number=Integer.valueOf(str);
            number+=1;
            System.out.println(number);
        }
        //fr.close();
            
        
        FileWriter fl= new FileWriter(f);
        System.out.println("Filewriter"+ number);
        fl.write(number+ "\n");
        fl.close();
        fr.close();
        System.out.println("-- creating tableWith spire --");
        System.out.println("I will create a doc");
        Document doc= new Document();
        
        System.out.println("Doc created - Add a section");
        Section section= doc.addSection();
        
        String[] header= {"Nom", "Prenom", "Age", "Nationalité"};
        String[][] data= {
                new String[] {"Kaneza","Belyse","32 ans", "Burundaise"},
                new String[] {"Kaitis", "Stephany", "24 ans", "Kenyanne"},
                new String[] {"Ndolbolo", "Yasolo", "30 ans", "Congolaise"},
                new String[] {"Kigeme", "Alphonsine", "65 ans", "Burundaise"},
                new String[] {"Kaneza","Belyse","32 ans", "Burundaise"},
                new String[] {"Kaitis", "Stephany", "24 ans", "Kenyanne"},
                new String[] {"Ndolbolo", "Yasolo", "30 ans", "Congolaise"},
                new String[] {"Kigeme", "Alphonsine", "65 ans", "Burundaise"}
        };
        
        System.out.println("Create the table");
        
        Table table= section.addTable(true);
        table.resetCells(data.length+1, header.length);
        
        TableRow row=table.getRows().get(0);
        row.isHeader(true);
        row.setHeight(20);
        row.setHeightType(TableRowHeightType.Exactly);
        row.getRowFormat().setBackColor(Color.GRAY);
        
        //add header
        
        for(int i=0; i<header.length; i++) {
            row.getCells().get(i).getCellFormat().setVerticalAlignment(VerticalAlignment.Middle);
            Paragraph p= row.getCells().get(i).addParagraph();
            p.getFormat().setHorizontalAlignment(HorizontalAlignment.Center);
            p.appendText(header[i]);
        }
        
        //add rest
        
        for(int i=0; i<data.length; i++) {
            TableRow tableR=table.getRows().get(i+1);
            for(int j=0; j<data[i].length; j++) {
                tableR.getCells().get(j).addParagraph().appendText(data[i][j]);
            }
        }
        
        //save a file
        for(int i=0; i<5; i++)
            table.addRow();
        
        table.applyHorizontalMerge(data.length+1, 0, 3);
        
        table.applyVerticalMerge(2, data.length+2, data.length+5);
        
        //table.getRows().get(data.length+3).getCells().get(1).splitCell(3, 3);
        
        
        System.out.println("Save the file");
        doc.saveToFile("C:/IOLS/createdTable-"+number+".docx", FileFormat.Docx_2013);
        System.out.println("Saved");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    
}

}

FXML source file

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.VBox?>

<VBox prefHeight="200.0" prefWidth="400.0" xmlns="http://javafx.com/javafx/8" 
xmlns:fx="http://javafx.com/fxml/1" fx:controller="doc.view.interfaceM">
<children>
  <Button fx:id="bouton" mnemonicParsing="false" onAction="#createTable" text="Button">
     <VBox.margin>
        <Insets left="174.0" right="174.0" top="90.0" />
     </VBox.margin>
  </Button>
 </children>

The jpackage command used

jpackage --module-path path-to-javafx-jmods --add-modules javafx.controls --add-modules javafx.fxml --input directory-with-jar  --name name --main-jar the-jar --main-class doc.docMain --win-shortcut --win-console.

I installed the app. When executed I get this error

3 Reading line: 11
12
Filewriter12
-- creating tableWith spire --
I will create a doc
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
    at [email protected]/javafx.fxml.FXMLLoader$MethodHandler.invoke(Unknown Source)
    at [email protected]/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(Unknown 
 Source)
    at 
 [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown 
 Source)
    at 
   [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
  Source)
    at 
    [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
  Source)
    at 
 
[email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown 
Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown     
  Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
    at [email protected]/javafx.scene.Node.fireEvent(Unknown Source)
    at [email protected]/javafx.scene.control.Button.fire(Unknown Source)
    at 
    [email protected]/com.sun.javafx.scene.
    control.behavior.ButtonBehavior.mouseReleased(Unknown 
   Source)
    at [email protected]/com.sun.javafx.scene.control.inputmap.InputMap.handle(Unknown 
   Source)
    at 
   [email protected]/com.sun.javafx.event.CompositeEventHandler
   $NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
    at 
   [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown 
   Source)
    at 
    [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
   Source)
    at 
   [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown 
   Source)
    at 
 [email protected]/com.sun.javafx.event.CompositeEventDispatcher.
  dispatchBubblingEvent(Unknown Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
 Source)
    at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown 
  Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
    at [email protected]/javafx.scene.Scene$MouseHandler.process(Unknown Source)
    at [email protected]/javafx.scene.Scene.processMouseEvent(Unknown Source)
    at [email protected]/javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
    at 
    [email protected]/com.sun.javafx.tk.quantum.
    GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at 
   [email protected]/com.sun.javafx.tk.quantum.
    GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at [email protected]/com.sun.javafx.tk.quantum.
   GlassViewEventHandler.lambda$handleMouseEvent$2(Unknown Source)
    at 
  [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown 
  Source)
    at [email protected]/com.sun.javafx.tk.quantum.
   GlassViewEventHandler.handleMouseEvent(Unknown Source)
    at [email protected]/com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
    at [email protected]/com.sun.glass.ui.View.notifyMouse(Unknown Source)
    at [email protected]/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at [email protected]/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown 
   Source)
    at java.base/java.lang.Thread.run(Unknown Source)
   Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javafx.reflect.Trampoline.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at [email protected]/com.sun.javafx.reflect.MethodUtil.invoke(Unknown Source)
    at [email protected]/com.sun.javafx.fxml.MethodHelper.invoke(Unknown Source)
    ... 47 more
   Caused by: java.lang.NoClassDefFoundError: com/spire/doc/Document
    at doc.view.interfaceM.createTable(interfaceM.java:60)
    ... 58 more
   Caused by: java.lang.ClassNotFoundException: com.spire.doc.Document
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    ... 59 more

I then thought that jpackage is not importing the Spire.Doc Library.
I tried changing spire.doc version / javafx version / I even used aspose word but still have the same issue. Thank you for your help. I m sorry for being long.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

魂归处 2025-02-17 06:58:58

感谢所有试图提供帮助的人。我弄清楚了这个问题。如果有人遇到相同的问题,则是解决方案。

情况

似乎JDK不再与Ant合作。因此,这就是我为使我的罐子

  1. 右键单击“
  2. 开头窗口”中的菜单中的“导出”
  3. ,然后选择“可运行的jar file” =&gt;接下来
  4. 有3个选项,我选择了2 nd“生成jar中的包装库”

=&gt;我得到的罐子工作得很好,但是安装程序中的安装程序无法正常工作。

解决方案是将步骤4

更改 。

我希望它能帮助某人。

“处理库”的屏幕截图

Thanks everybody who tried to help. I figured out the problem. If anyone is undergoing the same problems here is the solution.

Situation

It seems jdk does no longer work with ant. So this is what I did to make my jar

  1. right click on the project
  2. chose "Export" in the menu
  3. In the opening window chose Java and then "Runnable Jar file" => Next
  4. There are 3 options , I chosed the 2 nd "package required libraries in the generated Jar"

=> The Jar I got works very well but the installer from it won't work.

The solution is to change step 4.

Chose copy required libraries into a sub-folder next to the generated JAR instead

After that the JAR works and the exe installer gives a working application.

I hope it helps someone out there.

screenshot of "handling libraries"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文