Print at Dec 15, 2025, 6:38:09 PM
Posted by ilaria_123 at Oct 1, 2018, 2:23:02 PM
Export .jar plugin that depend on other libraries
Hello,

I realise this is a more general Java question, but I've been struggling with this for a few days and I thought I'd ask here as I'm sure people have encountered this before. As I mentioned in a different thread, I'm developing a plugin to read vertices from a .json file and draw a room with those vertices in Sweet Home 3D. I'm using the json-simple library to read json files. The plugin is finished and runs smoothly in Eclipse. However, when I export it and try to use it with the .exe or the executable Sweet Home 3D .jar, it fails because it cannot find the json-simple classes. Specifically, it gives me a "NoClassDefFoundError".

I read that Eclipse doesn't support the "repackaging" of other .jar dependencies into a single, final jar if that's not a runnable jar. I tried manually putting the .class files of json-simple in the jar and still no luck. I read that Maven is supposed to help with that but I found it very complicated and gave up. I was wondering if there was a way in Sweet Home 3D to link to external libraries or whether I just have to give up and learn how to use Maven.

Thank you very much,
Ilaria