Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nmare418 opened this issue Jul 5, 2021 · 4 comments
Open

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

nmare418 opened this issue Jul 5, 2021 · 4 comments

Comments

@nmare418
Copy link

nmare418 commented Jul 5, 2021

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

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
Copy link

farmboy0 commented Jul 5, 2021

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
Copy link
Author

nmare418 commented Jul 5, 2021

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
Copy link

farmboy0 commented Jul 6, 2021

@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
Copy link
Author

nmare418 commented Jul 6, 2021

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants