如何从模块中无法访问软件包(即如何从模块中删除软件包?)

发布于 2025-02-11 12:51:49 字数 1940 浏览 0 评论 0原文

简短版本

我必须从哪个文件夹中删除什么文件才能停止错误:

可以从多个模块访问包装%s:< named>%s

在尝试构建Java Web网站时,我会遇到错误:我遇到了错误

可以从多个模块访问包装%s:< named>%s

例如:

  • package org.w3c.dom可以从一个以上的模块中访问:\&lt ;未命名\>,java.xml
  • 可以从多个模块访问javax.xml.parsers:\< named \>,java.xml
  • 可以从多个模块访问netscape.javascript:\< named \>,jdk.jsobject
  • package org.xml.sax可以从一个以上的模块中访问:现在

​> .jar 文件),或者我需要编辑配置文件以删除一行,或者我需要在计算机上的其他地方删除文件,或者我需要删除环境变量。

  • 我不知道要删除什么文件,
  • 我不知道要删除的.jar
  • 我不知道要编辑什么文本文件,
  • 我不知道要编辑什么配置文件
  • 我don' t知道要添加,编辑或删除哪个文本文件中的哪一行

,我该如何:

制作包装%s 不是 可从一个以上的模块访问


显然是Java 9和

  • 一些您可以说您可以禁用JPMS 通过删除module-info.java
  • 其他人坚持认为您在Java 8之后完全无法禁用JPMS,您只需要在Java 8上生活,
  • 有些人说,如果您删除module-info, 。

  • ​classpath 或modulepath

尽管我没有classpath或modulepath集:

>echo %classpath%
%classpath%

>echo %modulepath%
%modulepath%

>echo %java_home%
C:\Program Files\Java\jdk-18.0.1.1

iDE: Visual Studio代码

项目结构

Web Sine由文件和文件夹的结构组成。有些可能是按照惯例在那里的,有些可能是限制的,有些可能是额外的东西的垃圾场。 不

Short Version

What file do i have to delete from what folder to stop the error:

The package %s is accessible from more than one module: <unnamed>, %s

Long Version

When trying to build a Java web-site, i am getting the error:

The package %s is accessible from more than one module: <unnamed>, %s

For example:

enter image description here

  • The package org.w3c.dom is accessible from more than one module: \<unnamed\>, java.xml
  • The package javax.xml.parsers is accessible from more than one module: \<unnamed\>, java.xml
  • The package netscape.javascript is accessible from more than one module: \<unnamed\>, jdk.jsobject
  • The package org.xml.sax is accessible from more than one module: \<unnamed\>, java.xml

Now:

  • I don't know what a module is
  • and i don't know what a package is

But i do get get the sense that i need to delete a file (maybe a .jar file), or i need to edit a configuration file to remove a line, or i need to delete files elsewhere on my computer, or i need to delete environment variables.

  • i don't know what file to delete
  • i don't know what .jar file to delete
  • i don't know what text file to edit
  • i don't know what configuration file to edit
  • i don't know what line in what text file to add, edit, or remove

So, how do i:

Make package %s not accessible from more than one module


Apparently it is an bug added with Java 9 and the Java Platform Module System (JPMS), and it is not anything to do with Eclipse, NetBeans, or any IDE. It is a rule that was always there, but only Java 9 started enforcing it.

  • Some say you can disable the JPMS by deleting module-info.java
  • Others insist that you cannot disable JPMS at all after Java 8, and you just have to live on Java 8
  • Some have said that if you delete module-info.java it will get re-created

I don't have a module-info.java file anywhere in the folder or subfolders of the project

  • Others suggest it is an issue with classpath, or modulepath

Although i don't have a classpath or modulepath set:

>echo %classpath%
%classpath%

>echo %modulepath%
%modulepath%

>echo %java_home%
C:\Program Files\Java\jdk-18.0.1.1

IDE: Visual Studio Code

Project structure

The web-site is make up of a structure of files and folders. Some are probably there by convention, some are probably there by rule, and some may have been a dumping ground for extra stuff. I don't know which is which:

  • ????.vscode
  • ????build
  • ????conf
  • ????dist
  • ????JMeter
  • ????LibrarySourceCode
  • ????nbproject (deleted in an attempt to fix the issue)
  • ????sql
  • ????src
  • ????WebRoot
    • ????applets
    • ????META-INF
    • ????WEB-INF
      • ????classes
      • ????lib
        • ????activation.jar
        • ????cglib-full-2.0.2.jar
        • ????commons-beanutils.jar
        • ????commons-codec-1.3.jar
        • ????commons-collections-2.1.1.jar
        • ????commons-collections4-4.4.jar
        • ????commons-compress-1.20.jar
        • ????commons-dbcp-1.2.1.jar
        • ????commons-digester.jar
        • ????commons-fileupload.jar
        • ????commons-lang-1.0.1.jar
        • ????commons-logging-1.2.jar
        • ????commons-math3-3.6.1.jar
        • ????commons-pool-1.2.jar
        • ????commons-validator.jar
        • ????curvesapi-1.06.jar
        • ????dom.jar
        • ????dom4j-1.4.jar
        • ????ehcache-0.9.jar
        • ????hibernate2.jar
        • ????itext-1.4.jar
        • ????jakarta-oro.jar
        • ????jaxen-full.jar
        • ????jaxp-api.jar
        • ????jmf.jar
        • ????jstl.jar
        • ????jta.jar
        • ????log4j-1.2-api-2.17.1.jar
        • ????log4j-api-2.17.1.jar
        • ????log4j-core-2.17.1.jar
        • ????log4j-jcl-2.17.1.jar
        • ????mail.jar
        • ????odmg-3.0.jar
        • ????ooxml-schemas-1.1.jar
        • ????plugin.jar
        • ????poi-3.9-20121203.jar
        • ????poi-ooxml-3.9-20121203.jar
        • ????poi-ooxml-schemas-3.9-20121203.jar
        • ????sax.jar
        • ????saxpath.jar
        • ????sessionmon.jar
        • ????sqljdbc41.jar
        • ????standard.jar
        • ????struts.jar
        • ????xalan.jar
        • ????xercesImpl.jar
        • ????xml-apis.jar
        • ????xmlbeans-3.0.1.jar
        • ????xmlbeans-4.0.0.jar
        • ????xmlbeans-5.0.3.jar
      • ????tags
  • ????build.xml (deleted in an attempt to fix the issue)

Research Effort

That's a restriction by the Java Platform Module System (JPMS), not by Eclipse (so don't shoot the messenger). If you delete the file module-info.java in your default package (which disables JPMS) it should work with Java 9 or higher.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文