0

**UPDATE: I closed and re-opened eclipse (which I've done before), and was presented with a new "quick fix" solution of moving the library to the module path (which it has been in before), and now I can reference it, but now

import com.jme3.app.SimpleApplication;

says

The package com.jme3.app is accessible from more than one module: jme3.core, jme3.desktop

my module-info now have warnings as well: module-info.java:

module vast {
    requires jme3.core; //Name of automatic module 'jme3.core' is unstable, it is derived from the module's file name.
    requires jme3.desktop; //the same(ish)
    requires jme3.lwjgl; // and so on
}

I'm going to fiddle around a bit and see what I can figure about those **

So, I've decided to migrate one of my projects from LWJGL3 to JME3 (using Eclipse). I followed the advice of Setting up JME3 in Eclipse, specifically downloading the library, extracting it to a lib subfolder in my project, I then added the contents of the library to a User-Library (using Add JARs, since they are in my project), and added the library to my classpath. I know eclipse sees the library (code suggestions), but I keep getting access errors.

Setup:

  • Arch Linux (latest)
  • Eclipse IDE for Java Developers (2019-12 (4.14.0))

Here's the code (small test class to make sure it runs before I refactor):

Test.java:

package lab.stone.werlious.vast;

import com.jme3.app.SimpleApplication; //the type com.jme3.app.SimpleApplication is not accessible.

public class Test extends SimpleApplication { //SimpleApplication cannot be resolved to a type

}

module-info.java:

module vast {
    requires jme3.core; // jme3.core cannot be resolved to a module
}

I've tried many different combinations of adding the library (modulepath, classpath, user library, external JARs, internal lib JARs), and referencing it. I keep getting errors, even though SimpleApplication suggests importing com.jme3.app.SimpleApplication, which suggests adding requires jme3.core to module-info.

I am not using maven or gradle (detest those), and prefer to do things locally. I also prefer eclipse over jme3 sdk. Can someone tell me how to properly import this library (without maven or gradle)? and how to properly import it in my code? I didn't have this issue adding LWJGL3 to eclipse before, and currently jme3 is added the same as lwjgl3 in my source project (jars in lib folder in project, lib folder added as user library, user library added to classpath).

Thank you all for your help

As a side note, because I'm sure someone will mention it, I've been on various forums for about 2 hours trying to figure this out, including stackexchange. I can't find a similar issue with a solution that works for me.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Werlious
  • 583
  • 6
  • 15
  • 1
    https://stackoverflow.com/questions/46834695/the-package-org-openqa-selenium-is-accessible-from-more-than-one-module – A Farmanbar Feb 10 '20 at 01:14
  • The Java Platform Module System (JPMS) does not allow to have the same package in more than one module. Each legacy JAR file is handled as separated module and the module name is derived from the file name (it is unstable because changing the file name would change also the module name). As a workaround you can merge the _jme3_ JARs into a single JAR. Alternatively, you can not use JPMS by deleting the `module-info.java' file and move the JARs from the modulepath to the classpath (everything on the classpath is handled as in the UNNAMED module). – howlger Feb 10 '20 at 20:32

0 Answers0