Auron Posted August 13, 2022 Share Posted August 13, 2022 Hi, I'm trying to use an extenal library to handle json parsing (in this case json-simple-1.1.1.jar) This was all working for me fine about 10 months ago, but upon returning, it no longer works, I simply get java.lang.ClassNotFoundException: org.json.simple.parser.ParseException I am using InetIliJ 2021.2.2 Community, and I have: have added the jar as an External library added the jar into the artifact ("Put into Output Root") tried adding the library to a lib directory, and launching osbot using this directory as a classpath. E.G "C:\Program Files\Java\jre1.8.0_301\bin\java.exe" -cp "lib/*" org.osbot.Boot -debug Does anybody have any ideas as to what I could be doing wrong? Has something changed in the last 10 months as to not allow external jars? Thanks a lot! This is essentially a duplicate of the thread below, but the solution does not work for me. Quote Link to comment Share on other sites More sharing options...
Gunman Posted August 13, 2022 Share Posted August 13, 2022 @Auron Check the jar and see if the library was added into the script jar, if not then that's the problem. Worst case you can switch to GSON library that is built into the OSBot client. Quote Link to comment Share on other sites More sharing options...
Auron Posted August 14, 2022 Author Share Posted August 14, 2022 12 hours ago, Gunman said: @Auron Check the jar and see if the library was added into the script jar, if not then that's the problem. Worst case you can switch to GSON library that is built into the OSBot client. @Gunman Thanks for the reply. Good shout, I forgot about looking in the jar. The jar certainly existed inside the script jar, but it still didn't work. However, I tried extracting the Jar into the output root and it works! (Although I could have sworn I tried that before...) My solution 10 months ago was not putting the Jar in the artifact, but putting the jar on the classpath when running osbot. This is what seems to no longer work. Thanks. Quote Link to comment Share on other sites More sharing options...
Auron Posted August 14, 2022 Author Share Posted August 14, 2022 @GunmanDamn, actually I think I've hit a wall here. I had another Jar I needed to add (mysql-connector-java), but if I try and extract that into my script jar, not only do I get a lot of "Failed to load local script" for all the mysql classes, and when I try and run the script, I get java.lang.ExceptionInInitializerError ... Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setContextClassLoader") I have a feeling there's no workaround for this - is there a way to connect to a local database? Or is the only solution here to create a proxy whereby you have to communicate with http requests or something? Quote Link to comment Share on other sites More sharing options...
Gunman Posted August 15, 2022 Share Posted August 15, 2022 On 8/14/2022 at 3:24 AM, Auron said: is there a way to connect to a local database? Or is the only solution here to create a proxy whereby you have to communicate with http requests or something? Use sockets Quote Link to comment Share on other sites More sharing options...