Holger
Holger

Reputation: 1

jopendocument error in Eclipse - Unable to derive module descriptor

When executing a simple programm that aims to write a string into an ods-File, i get an error in eclipse.

Here's the error:

java.lang.module.FindException: Unable to derive module descriptor for /home/benutzer/Documents/Java/Eclipse/FNetParser/src/jOpenDocument.jar Caused by: java.lang.module.InvalidModuleDescriptorException: JDOMAbout$Info.class found in top-level directory (unnamed package not allowed in module)

Now here's how I got there: I wrote a class that uses the jopendocument-1.5.rar library to write a string into a cell in an .ods-file. I downloaded the jar here: https://jopendocument.org/download.html (I downloaded version 1.5) and the code looks like this:

import java.io.File;
import java.io.IOException;
import org.jopendocument.dom.spreadsheet.Sheet;
import org.jopendocument.dom.spreadsheet.SpreadSheet;


public class SpreadSheetHandler {
    
    public static void main() {
    
        SpreadSheetHandler ssh = new SpreadSheetHandler();  
        ssh.writeStringToCell("L1", "Test");
            
    }
        
    
    public void writeStringToCell (String str_cell, String str_value) {
        
        File odc_WpDaten = new File("/home/benutzer/Desktop/Aktien/20230103_Aktienliste.ods");
        
        //odc_WpDaten.loadFrom("/home/benutzer/Desktop/Aktien/20230103_Aktienliste.ods");
        
        Sheet sht_WpDaten;
        try {
            sht_WpDaten = SpreadSheet.createFromFile(odc_WpDaten).getSheet("Sheet1");
            
sht_WpDaten.getCellAt(str_cell).setValue("str_value");
            
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

All the programm is supposed to do is open an .ods file and write "Test" in cell L1. That's it.

I have added the jopendocument library to my project like other libraries before (Add library..., then add to build path...) I have also aligned to names of the jar file (renamed the .jar file "jopendocument.jar") and of the entry in the module-info.java file. I still get the error.

The content of module-info.java looks like this:

/**
 * 
 */
/**
 * @author benutzer
 *
 */
module FNetParser {
    requires jOpenDocument;
}

It doesn't look like a coding problem to me. More like some issue with setting this ominous "module descriptor" in eclipse. Does anyone know where i can find the "module descriptor", that is mentioned in the error message?

I the module-info.java, "jopendocument" is underlined, when i hover over it, the tooltip reads: "Name of automatic module "jopendocument" is unstable. It is derived from the module's filename.

Upvotes: 0

Views: 194

Answers (0)

Related Questions