B4J Question How do I get to the DiskUtil lib?

rfresh

Well-Known Member
Licensed User
Longtime User
How do I get to the DiskUtil lib? I don't see it in the Libraries Manager tab.
 

stevel05

Expert
Licensed User
Longtime User
I haven't tried it, but it says it's a code module. So unzip the file and you should have a .bas file which you can load using Project/Add Existing Module or drag and drop it from the file explorer onto the Modules tab.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Sorry, no, not that one, this one: JDiskutil

But that one only has a .jar file and an .xml file. I don't know what I need to do with one or both of them to access its methods?
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
Simply copy both files into your AdditionalLibraries\B4J folder.
You may have a look HERE.
Got it. Thanks Klaus.

I'm able to get the disk serial number to display OK using Log() with this line:

B4X:
    Dim diskserial As DiskUtil
    diskserial.Initialize("DiskSerial")
    Log("diskserial " & diskserial.getSerialNumber("c:\"))

But when my project runs, I also see this in the Log window:

java.lang.Exception: Sub diskserial_result was not found.
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
There is only a .jar file and an .xml file. I did not find the string "diskserial_result" in the .xml file.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
There is only a .jar file and an .xml file. I did not find the string "diskserial_result" in the .xml file.
"discserial" is the Eventprefix YOU DID SET

From the XML
<event>result(Successful As Boolean, DriveSerial as String)</event>
<event>drives(Successful As boolean, DriveNames() As Object)</event>

create the missing Event sub
B4X:
sub discserial_result(Successful As Boolean, DriveSerial as String)
End sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…