Example: /Java/Java Get System Property

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem