Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Trouble using external libraries (java.lang.NoClassDefFoundError)

Featured Replies

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.

  • Author
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.

  • Author

@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?
 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.