Hello,
I am trying to convert some functions on this page : http://docs.oracle.com/javase/7/docs/api/javax/swing/filechooser/FileSystemView.html
But with this code, I get this error :
I don't get it. I tried so many variations of this code, but no luck so far.
Thanks for your help.
jmon
I am trying to convert some functions on this page : http://docs.oracle.com/javase/7/docs/api/javax/swing/filechooser/FileSystemView.html
B4X:
Public Sub isDrive(Path As String) As Boolean
Dim FileJO As JavaObject
FileJO.InitializeStatic("java.io.File")
Dim FileSystemView As JavaObject
FileSystemView.InitializeStatic("javax.swing.filechooser.FileSystemView")
FileJO = FileSystemView.RunMethod("createFileObject", Array As String(Path))
Return FileSystemView.RunMethod("isDrive", Array As Object(FileJO))
End Sub
Sub AppStart (Args() As String)
Log(isDrive("C:\"))
End Sub
But with this code, I get this error :
main._isdrive (java line: 70)
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:80)
at b4j.example.main._isdrive(main.java:70)
at b4j.example.main._appstart(main.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at b4j.example.main.main(main.java:26)
I don't get it. I tried so many variations of this code, but no luck so far.
Thanks for your help.
jmon