Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Java/Java Set 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 Set System Property
This example is the version from Mon, 25th Mar 2012.
Project "Java Set System Property.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() dim options() as string dim javaVm as new JavaVMMBS(JavaVMMBS.JNI_VERSION_1_4, options, true) Dim system As JavaClassMBS = javaVm.FindClass("java/lang/System") dim transfomerSetPropertyId as JavaMethodMBS = system.GetStaticMethod("setProperty", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;") dim transfomerGetPropertyId as JavaMethodMBS = system.GetStaticMethod("getProperty", "(Ljava/lang/String;)Ljava/lang/String;") Dim keyString As JavaStringMBS = javaVm.NewStringUTF8("javax.xml.transform.TransformerFactory") Dim valueString As JavaStringMBS = javaVm.NewStringUTF8("net.sf.saxon.TransformerFactoryImpl") Dim m As MemoryBlock = New MemoryBlock(16) m.long(0)=keyString.Handle m.long(8)=valueString.Handle dim o as JavaObjectMBS = system.CallStaticObjectMethod(transfomerSetPropertyId, m) m = New MemoryBlock(8) m.long(0)=keyString.Handle dim r as JavaObjectMBS = system.CallStaticObjectMethod(transfomerGetPropertyId, m) if r<>Nil then dim s as JavaStringMBS = JavaStringMBS(r) MsgBox s.CopyStringUTF 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 tutorial videos