Note: new to Java programming; not new to programming in general.
So my scripts are getting longer and more complex, therefore I am trying to store logic in different files and different classes. I feel as if I have tried every possible way, but I am getting stuck on the following error:
Blocked permission: ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.activation.registries")
I have made the following class "ExampleScript":
import generic.*;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
@ScriptManifest(author = "author", info = "info", logo = "", name = "name", version = 0)
public class ExampleScript extends Script {
@Override
public int onLoop() throws InterruptedException {
Test testClass = new Test();
testClass.testFunction();
return random(100, 500);
}
}
The generic package import (line 1) is a simple package I've created with therein a class called "Test" with the following code:
package generic;
import static com.sun.activation.registries.LogSupport.log;
public class Test {
public static void testFunction() {
log("If this would just log without a error that'd be great...");
}
}
My file structure is as followed:
> src
> generic
> Test.java
ExampleScript.java
Other notes of possible solutions I have tried:
- Having both classes in the same package; gives the same Blocked Permission error;
- Adding to my java.security the lines (see underneath);
- Re-installing Java, rebooting the client, creating new projects;
- Losing my mind :-).
Please note: I am just trying to get logic into multiple files, maybe there's a way better way of doing this in Java; let me know!
Thanks.
Also, it is good to note that I can actually create an instance of Test, I can also log Test. However, once running the function within Test I get the error.