Luaj not working with JavaFX (and eclipse)? #92

Closed
opened 2021-07-05 02:57:40 +00:00 by nmare418 · 4 comments
nmare418 commented 2021-07-05 02:57:40 +00:00 (Migrated from github.com)

I have to convert my project from SWT to JavaFX. This project make a great use of luaj for coercion and executions of lua scripts and worked well in swt.

But there a difference with javafx. Javafx work as a module.

Since then, i have troubles with luaj.

Tried 2 differente way:

*** With luaj in the class path**

Eclipse dont see it anymore (The type org.luaj.vm2.[...] is not accessible). Tried to play with the order but still not working.

*** With luaj as a auto-named module**

i tried as a user lib or directly as an external jar.

In this case, eclise see luaj packages. But when i run, i have the message

Error occurred during initialization of boot layer

java.lang.module.FindException: Unable to derive module descriptor for E:\eclipse-workspace\Lib\luaj-3.0.1\lib\luaj-jse-3.0.1.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: luajc.class found in top-level directory (unnamed package not allowed in module)

I think that the lib file is badly named. i have a warning saying "Name of automatic module luaj.jse is unstable", but when i try to rename it, i have an error as eclipse search the old file name..

i saw somewhere in forums that luaj is not compatible as a module. You can confirm?

I use jdk-16 and eclipse version 2020-09 (4.17.0)
here my module-info...

-- with luaj in the classpath

module dusandbox {
requires javafx.graphics;
requires javafx.controls;
requires javafx.base;
requires javafx.fxml;
requires javafx.media;
requires javafx.swing;
requires javafx.swt;
requires javafx.web;
requires java.xml;
exports dusandbox;
exports dusandbox.setup;
exports dusandbox.obj;
opens dusandbox.setup to javafx.fxml;
opens dusandbox.obj to javafx.fxml;
}

VM Arguments
--module-path "E:\eclipse-workspace\Lib\javafx-sdk-11.0.2\lib"
--add-opens javafx.graphics/com.sun.javafx.text=ALL-UNNAMED

.classpath

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

I am lost, and i have to stop my project to resolve this. I really worked on that JavaFX port.

I am searching since 2 days and i am very confused! If someone have some ideas please.

Thank you

I have to convert my project from SWT to JavaFX. This project make a great use of luaj for coercion and executions of lua scripts and worked well in swt. But there a difference with javafx. Javafx work as a module. Since then, i have troubles with luaj. Tried 2 differente way: *** With luaj in the class path** Eclipse dont see it anymore (The type org.luaj.vm2.[...] is not accessible). Tried to play with the order but still not working. *** With luaj as a auto-named module** i tried as a user lib or directly as an external jar. In this case, eclise see luaj packages. But when i run, i have the message Error occurred during initialization of boot layer java.lang.module.FindException: Unable to derive module descriptor for E:\eclipse-workspace\Lib\luaj-3.0.1\lib\luaj-jse-3.0.1.jar Caused by: java.lang.module.InvalidModuleDescriptorException: luajc.class found in top-level directory (unnamed package not allowed in module) I think that the lib file is badly named. i have a warning saying "Name of automatic module luaj.jse is unstable", but when i try to rename it, i have an error as eclipse search the old file name.. i saw somewhere in forums that luaj is not compatible as a module. You can confirm? I use jdk-16 and eclipse version 2020-09 (4.17.0) here my module-info... -- with luaj in the classpath module dusandbox { requires javafx.graphics; requires javafx.controls; requires javafx.base; requires javafx.fxml; requires javafx.media; requires javafx.swing; requires javafx.swt; requires javafx.web; requires java.xml; exports dusandbox; exports dusandbox.setup; exports dusandbox.obj; opens dusandbox.setup to javafx.fxml; opens dusandbox.obj to javafx.fxml; } VM Arguments --module-path "E:\eclipse-workspace\Lib\javafx-sdk-11.0.2\lib" --add-opens javafx.graphics/com.sun.javafx.text=ALL-UNNAMED .classpath <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry excluding="fxml/|picture/|pictures/" kind="src" path="src"> <attributes> <attribute name="module" value="true"/> <attribute name="add-exports" value="dusandbox/dusandbox.setup=dusandbox"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFx"> <attributes> <attribute name="module" value="true"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> <attributes> <attribute name="module" value="true"/> </attributes> </classpathentry> <classpathentry kind="lib" path="E:/eclipse-workspace/Lib/luaj-3.0.1/lib/luaj-jse-3.0.1.jar"/> <classpathentry kind="lib" path="E:/eclipse-workspace/Lib/javax.xml.bind.jar"/> <classpathentry kind="output" path="bin"/> </classpath> I am lost, and i have to stop my project to resolve this. I really worked on that JavaFX port. I am searching since 2 days and i am very confused! If someone have some ideas please. Thank you
farmboy0 commented 2021-07-05 09:10:36 +00:00 (Migrated from github.com)

If modules dont allow for classes in the default package then this library is indeed not compatible with modules. Thoese classes are used as main classes to call on the command line thats why they have no package name to make calling them shorter i guess.

If modules dont allow for classes in the default package then this library is indeed not compatible with modules. Thoese classes are used as main classes to call on the command line thats why they have no package name to make calling them shorter i guess.
nmare418 commented 2021-07-05 11:40:07 +00:00 (Migrated from github.com)

I dont know much about modules... I have to find a way to encapsulate luaj in my project maybe...

I cant give up... I made a cool sandbox system with luaj, it begin to be popular, but my users dislike the GUI.

I dont know much about modules... I have to find a way to encapsulate luaj in my project maybe... I cant give up... I made a cool sandbox system with luaj, it begin to be popular, but my users dislike the GUI.
farmboy0 commented 2021-07-06 13:18:07 +00:00 (Migrated from github.com)

@nmare418 if you dont use dependencies via maven or gradle why not just remove those classes from the jar and see if this works

@nmare418 if you dont use dependencies via maven or gradle why not just remove those classes from the jar and see if this works
nmare418 commented 2021-07-06 14:50:42 +00:00 (Migrated from github.com)

Solved:

Switched back to non-module project by removing the module-info and added all javafx libs in the module-path.

I replaced the VM arguments by

--module-path "E:\eclipse-workspace\Lib\javafx-sdk-11.0.2\lib"
--add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.web

Notice that you have to select which javafx modules you want to use in the add-modules argument

I had a good fear! I didn't want to redo all my work after a 100 hours.

Solved: Switched back to non-module project by removing the module-info and added all javafx libs in the module-path. I replaced the VM arguments by --module-path "E:\eclipse-workspace\Lib\javafx-sdk-11.0.2\lib" --add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.web Notice that you have to select which javafx modules you want to use in the add-modules argument I had a good fear! I didn't want to redo all my work after a 100 hours.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-autonomous-connection/luaj#92