Aug 28, 2023 Replies: 1 Sometimes you just need to use a JavaObject to get a value to log for example. ( Be aware it makes the code harder to read using the tips below) Normally you would write Code: Copy ... Dim jo As JavaObject Log( jo.InitializeStatic("some.java.class").RunMethod("someJavaMethod",Null) ) ... You can get the same result without having to create a new JavaObject - just cast Null to JavaObject Code: Copy ... Log( (Null).As(JavaObject).InitializeStatic("some.java.class").RunMethod("someJavaMethod", Null) ) ... Or create a JavaObject on it's Dim line Code: Copy ... Dim myVar As JavaObject = (Null).As(JavaObject).InitializeStatic("some.java.class") myVar.RunMethod("someMethod",Null) .. Use at your peril lol. Click to expand...
Sometimes you just need to use a JavaObject to get a value to log for example. ( Be aware it makes the code harder to read using the tips below) Normally you would write Code: Copy ... Dim jo As JavaObject Log( jo.InitializeStatic("some.java.class").RunMethod("someJavaMethod",Null) ) ... You can get the same result without having to create a new JavaObject - just cast Null to JavaObject Code: Copy ... Log( (Null).As(JavaObject).InitializeStatic("some.java.class").RunMethod("someJavaMethod", Null) ) ... Or create a JavaObject on it's Dim line Code: Copy ... Dim myVar As JavaObject = (Null).As(JavaObject).InitializeStatic("some.java.class") myVar.RunMethod("someMethod",Null) .. Use at your peril lol.
stevel05 Expert Licensed User Longtime User Aug 28, 2023 #2 It might be safer to use any other object you have to hand rather than Null, even an empty string "".As(Javaobject). Although it's probably just in my mind.
It might be safer to use any other object you have to hand rather than Null, even an empty string "".As(Javaobject). Although it's probably just in my mind.