Platforms to show: All Mac Windows Linux Cross-Platform

/Java/Java Get System Property


Required plugins for this example: MBS Java Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Java/Java Get System Property

This example is the version from Tue, 6th Mar 2023.

Project "Java Get System Property.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() #If TargetMacOS Then // change the path for your installation! JavaVMMBS.SetLibraryPath("/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home/lib/server/libjvm.dylib") #ElseIf TargetLinux Then // change path for your linux PC! JavaVMMBS.SetLibraryPath("/home/cs/jre1.6.0_05/lib/i386/client/libjvm.so") #EndIf // init Java Dim options() As String Dim javaVm As New JavaVMMBS(JavaVMMBS.JNI_VERSION_1_4, options, True) // Get system class Dim System As JavaClassMBS = javaVm.FindClass("java/lang/System") If System <> Nil Then // query method Dim transfomerGetPropertyId As JavaMethodMBS = System.GetStaticMethod("getProperty", "(Ljava/lang/String;)Ljava/lang/String;") If transfomerGetPropertyId <> Nil Then // make parameters Dim keyString As JavaStringMBS = javaVm.NewStringUTF8("java.version") Dim m As New MemoryBlock(8) m.Int64Value(0)=keyString.Handle // run it Dim r As JavaObjectMBS = System.CallStaticObjectMethod(transfomerGetPropertyId, m) If r<>Nil Then // show result Dim s As JavaStringMBS = JavaStringMBS(r) MsgBox s.CopyStringUTF End If End If End If End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Java Plugin.


The biggest plugin in space...