Windows Portable Path

I really have a Windows / Java question. I have a connected device that I want to access through Java. You can usually access, for example. A USB stick through the drive letter ... but this tablet appears as a "portable device" by Windows ... which means that Path is something like "Computer \ Archos 5S" and there is no drive letter.

I want to access the file on this device through Java, but I cannot find the correct path to it. There is a similar question, but without a productive answer. Or is there any other way to access this device through Java?


Actually, I have not solved this problem ... I still cannot access such a device through java.

I'm currently trying to access ShellFolder windows in Java. Shell Shell: "Shell: {35786D3C-B075-49b9-88DD-029876E11C01}"

Is this possible with Java? I recently discovered the sun.awt class "ShellFolder" ... is this an interesting feature?

thanks for your help ripei

+6
java windows device tablet
source share
3 answers

Solving the above problem using the JMTP library at https://code.google.com/p/jmtp/

Here is my code

package jmtp; import be.derycke.pieter.com.COMException; import be.derycke.pieter.com.Guid; import java.io.*; import java.math.BigInteger; import jmtp.PortableDevice; import jmtp.*; public class Jmtp { public static void main(String[] args) { PortableDeviceManager manager = new PortableDeviceManager(); PortableDevice device = manager.getDevices()[0]; // Connect to my mp3-player device.open(); System.out.println(device.getModel()); System.out.println("---------------"); // Iterate over deviceObjects for (PortableDeviceObject object : device.getRootObjects()) { // If the object is a storage object if (object instanceof PortableDeviceStorageObject) { PortableDeviceStorageObject storage = (PortableDeviceStorageObject) object; for (PortableDeviceObject o2 : storage.getChildObjects()) { // // BigInteger bigInteger1 = new BigInteger("123456789"); // File file = new File("c:/JavaAppletSigningGuide.pdf"); // try { // storage.addAudioObject(file, "jj", "jj", bigInteger1); // } catch (Exception e) { // //System.out.println("Exception e = " + e); // } // System.out.println(o2.getOriginalFileName()); } } } manager.getDevices()[0].close(); } } 

Remember to add the jmtp.dll files (which comes with the jmtp download) as a native library. For more information, see My answer to the Including Native Library in Netbeans .

+4
source share

Like * nix systems, all devices (including disks) have paths that are part of a common root, this is usually hidden from users because they use drive letters that are aliases for these main paths, but you can also use the full path of devices by prefixing paths using "\\.\"

For example, on my machine, D: translates to "\Device\HarddiskVolume1" and can be accessed by passing "\\.\HarddiskVolume1" to CreateFile.

Thus, the path to your device is probably "\\.\Archos 5s" .

+2
source share

you can always download and install Windows Mobile Developer Powertoys (http://www.microsoft.com/download/en/details.aspx?id=10601) and copy it to and from your device using the cecopy command-line utility, which can be launched from any programming language. There are other options, but they are most focused on .Net

0
source share

All Articles