Xojo Conferences

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 Mon, 25th Mar 2012.
Project "Java Get System Property.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() // 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("os.version") dim m as New MemoryBlock(8) m.long(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:

Feedback, Comments & Corrections

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

MBS Xojo Plugins