Can't run java project with module warning [message #1831055] |
Tue, 11 August 2020 00:10 |
|
I have a simple java project that has a lib folder with swt.jar in it. It was added to the modulepath in the project's Properties > Java build path > Libraries dialog. When I import and use an swt class in my class, I'm prompted to add an entry to my module-info file. It adds "swt" with a warning:
Name of automatic module 'swt' is unstable, it is derived from the module's file name.
When I try to run the project as a java application I get this error in console and nothing runs:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module swt not found, required by ca.footeware.swt.converter
If I export the project as a runnable jar with dependencies enclosed, it works with a similar warning. The exported jar does run (but it's not a convenient development cycle :)
On another note, if instead of adding the jar to a lib folder, I add it as a user library, the export wizard fails to package the dependency in the jar and it doesn't run. But I'll save that one for another day.
I'm running eclipse 4.16 with OpenJDK-14.
Any help appreciated,
Craig
|
|
|
Re: Can't run java project with module warning [message #1831121 is a reply to message #1831055] |
Tue, 11 August 2020 22:38 |
|
Update: I read somewhere that for non-modular jars a MANIFEST.MF header, Automatic-Module-Name, can be used. I cracked open the swt.jar and added the header with value org.eclipse.swt, the root package of the jar. I removed the Requires swt; from my module-info.java and again was prompted to add an entry from my class with an swt import. This time though it entered Requires org.eclipse.swt; and no warning was produced. When I tried running the project however I got the same error:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module org.eclipse.swt not found, required by ca.footeware.swt.converter
Any ideas anyone,
Craig
|
|
|
|
|
Re: Can't run java project with module warning [message #1831444 is a reply to message #1831285] |
Thu, 20 August 2020 01:14 |
|
Well after reading a great deal I'm convinced my error running a modular project, depending on swt, in eclipse is due to my Run Configuration.
My project and module-info.java:
My Run Configuration's VM args:
--module-path /home/craig/Downloads/swt.jar;/home/craig/workspace/ca.footeware.converter
I tried dropping the .jar to reference only the module name in the jar but I get the same error, i.e.:
--module-path /home/craig/Downloads/swt;/home/craig/workspace/ca.footeware.converter
My runtime error:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module swt not found, required by ca.footeware.converter
So I believe it finds my ca.footeware.converter module but not the swt module, the automatically named module it requires.
Here's my Java Build Path Libraries and Modules pages:
Any ideas? Lots of simple examples out there but nothing that addresses my situation very well.
Craig
|
|
|
|
Powered by
FUDForum. Page generated in 0.02663 seconds