2014-09-01 2 views
1

jmtp.jar을 사용하여 Linux OS에 연결된 휴대용 장치를 모니터하고 싶습니다. 아래는 동일한 작업을 수행하는 데 사용하는 코드입니다. Windows에서 잘 작동하지만이 코드를 실행하면 "지원되지 않는 OS 예외"라는 메시지가 나타납니다. jmtp.jar는 Linux OS를 지원합니까? 그렇다면 리눅스 OS를위한 대안 솔루션이 아니면?jmtp.jar을 사용하여 Linux에 설치된 휴대용 장치 찾기 OS

Exception in thread "main" java.lang.RuntimeException: not supported os 
    at jmtp.PortableDeviceManager.<init>(PortableDeviceManager.java:37) 
    at find_usb.Jmtp.main(Jmtp.java:24) 

답변

0

구글 상태 :

A project aimed at allowing java programs to access MTP compabitble portable 
media players. The main target is currently windows, by wrapping the WPD api, 
but design decisions have been made to support both linux and mac os x in 
the future with the same API. For more information, please see the wiki. 
+0

그래서 다른 대안이 같은 행동을 할 내가 가지고

import java.io.*; import java.math.BigInteger; import jmtp.PortableDevice; import jmtp.PortableDeviceManager; import jmtp.PortableDeviceObject; import jmtp.PortableDeviceStorageObject; public class Jmtp { public static void main(String[] args) { PortableDeviceManager manager = new PortableDeviceManager(); PortableDevice device = manager.getDevices()[0]; 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()) { System.out.println(o2.getOriginalFileName()); } } } manager.getDevices()[0].close(); } } 

예외를 사용

코드? 다른 API 나 리눅스를위한 다른 것들처럼? – user2996582

관련 문제