Luaj not working with JavaFX (and eclipse)? #92
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
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.
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.
@nmare418 if you dont use dependencies via maven or gradle why not just remove those classes from the jar and see if this works
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.