January 19, 20215 yr I am having an issue with writing files try { log("Autosaving " + data.size() + " properties to " + getDirectoryData() + "osbot-anims.json"); String jsonFormat = gson.toJson(data); FileWriter fw = new FileWriter(new File(getDirectoryData() + "osbot-anims.json")); fw.write(jsonFormat); fw.flush(); fw.close(); } catch (Exception e) { log(e.getMessage()); e.printStackTrace(); } gives output [INFO][Bot #1][01/19 06:16:47 PM]: Autosaving 3 properties to C:\Users\Mark\OSBot\Data\osbot-anims.json [INFO][Bot #1][01/19 06:16:47 PM]: access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks") Edited January 19, 20215 yr by Bobbey
January 19, 20215 yr I did some quick googling and I think the issue is with gson using reflection. My guess is osbot won't let you use reflection, so you can try to google how to use gson without reflection.
January 19, 20215 yr Google "gson avoid reflection" First result on stack exchange should work, but I cannot guarantee you won't run into any other issues.
January 19, 20215 yr Author 4 minutes ago, Jarl said: Google "gson avoid reflection" First result on stack exchange should work, but I cannot guarantee you won't run into any other issues. I just found out that the library you linked actually works as well String jsonFormat = new JSONObject(data).toString(); So nvm my crying Edited January 19, 20215 yr by Bobbey
Create an account or sign in to comment