Sana Posted May 7, 2019 Share Posted May 7, 2019 (edited) Java noob here. Seasoned in other languages but haven't ever used Java in production. I've already Googled and found solutions to this problem, but they do not work for me. Posting here just to make sure it's not an OSBot-specific issue. I followed step #1 on this OSBot tutorial. I added json-simple-1.1.jar to my project so I can use the following imports: import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; I also followed this video on how to ass a .jar to your classpath. The issue occurs when I rebuild the artifact and refresh scripts in OSBuddy, after running it I get this stack trace saying it can't find the class, even though I already added it and it builds fine in IntelliJ IDE: Quote java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException at script.REDACTED.onStart(REDACTED.java:145) at org.osbot.rs07.event.ScriptExecutor.iiiIIiiIIiIi(ah:57) at org.osbot.rs07.event.ScriptExecutor.start(ah:1) at org.osbot.FA.iiiIIiiIIiIi(zv:193) at org.osbot.zA.iIiIIiiIiiii(wab:15) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: org.json.simple.parser.ParseException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 8 more Anyone know what's going on here? How can I get this new package added to the classpath so the error goes away? Edited May 7, 2019 by Lansana Camara Quote Link to comment Share on other sites More sharing options...
Token Posted May 7, 2019 Share Posted May 7, 2019 The error comes from the way you built the script jar file, make sure you include the dependencies in the exported jar (simple json dependency in this case) Quote Link to comment Share on other sites More sharing options...
Sana Posted May 7, 2019 Author Share Posted May 7, 2019 4 minutes ago, Token said: make sure you include the dependencies in the exported jar (simple json dependency in this case) Hey, thanks for your response. Can you elaborate on this part a bit? In IntelliJ IDE 2019.1, I went to "File -> Project Structure -> Modules -> Dependencies" and then I added the json package .jar and also checked the box "Export" next to it, then hit "Apply" and "OK". This does not work, either. Quote Link to comment Share on other sites More sharing options...
Token Posted May 7, 2019 Share Posted May 7, 2019 4 minutes ago, Lansana Camara said: Hey, thanks for your response. Can you elaborate on this part a bit? In IntelliJ IDE 2019.1, I went to "File -> Project Structure -> Modules -> Dependencies" and then I added the json package .jar and also checked the box "Export" next to it, then hit "Apply" and "OK". This does not work, either. The script jar is built using an artifact, so look under artifacts and add the simple json jar under the output structure Quote Link to comment Share on other sites More sharing options...
Sana Posted May 7, 2019 Author Share Posted May 7, 2019 4 minutes ago, Token said: The script jar is built using an artifact, so look under artifacts and add the simple json jar under the output structure Ugh, IntelliJ is so stupid. Did what you said already, added the .jar from Project Libary and Global Library. Clicking "Library Files" to add it doesn't work, you have to click "Extracted Directory" to add it. Every StackOverflow answer says to click otherwise. Whatever, it's solved now. Thanks a bunch. Quote Link to comment Share on other sites More sharing options...