Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Tika Apache error(The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml)
Tika Apache error [message #1859348] Thu, 01 June 2023 14:51 Go to next message
henry Verdoux is currently offline henry VerdouxFriend
Messages: 2
Registered: June 2023
Junior Member
Hi,
I'm having a issue with Apache Tika 2.8.0. When I import try to import the package org.xml.sax, Eclipse shows an error:

The package org.xml.sax is accessible from more than one module: <unnamed>, java.xml.
The problem seems to be : <unnamed> implies that your code is not in a module. You should probably put it in a module, i.e. create a module-info.java file. Another person said me : The package org.xml.sax is contained in the system library module java.xml and a package must not be contained in more than one module. The solution is not to have packages in your code or dependencies that also exist in the system library or to use Java 8.
Well, I would like to continue using Java 17 or later. And I tested the following solution:
If you add module-info.java to your project, you can control via requires which module your project reads, either requires java.xml; or requires xml.apis;
I did, and it doesn't work out.
Anyone could me explain step by step for solving this issue?

Re: Tika Apache error [message #1859504 is a reply to message #1859348] Mon, 12 June 2023 19:52 Go to previous message
Kabiru Usman is currently offline Kabiru UsmanFriend
Messages: 42
Registered: April 2023
Member

  • Create a module-info.java file: If you haven't already, create a module-info.java file in your project root directory. It should look like this:
    Replace your.module.name with your actual module name.

module your.module.name {
    requires java.xml;
    // your other dependencies
}



  • Use --add-exports option: You need to make sure that the JVM is aware of your decision to use the org.xml.sax from the java.xml module. You can achieve this using the --add-exports JVM option. Here's how you can do this in Eclipse: a. Right click on your project, go to 'Run As' -> 'Run Configurations'. b. Find the 'Arguments' tab and under the 'VM Arguments' section, add the following line:

--add-exports java.xml/org.xml.sax=your.module.name



  • Clean and Rebuild: Clean your project (Project -> Clean) and then build your project again (Project -> Build All).

That should help to resolve the issue. Remember, if you have other dependencies that are creating the same problem, you might need to do this for each one.

Previous Topic:failure to launch debian package (javafx)
Next Topic:No quick fix for some missing imports
Goto Forum:
  


Current Time: Fri Apr 26 23:55:20 GMT 2024

Powered by FUDForum. Page generated in 0.03945 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top