2013-06-13 18 views
-4

我想在Mac上連接Iphone設備。 我已經嘗試了下面的代碼在我的應用程序中找到它。如何在Java桌面應用程序中使用Iphone連接便攜式設備?

FileSystemView fsv = FileSystemView.getFileSystemView(); 
File[] roots = fsv.getRoots(); 

File[] f = File.listRoots(); 
System.out.println("dao.getDevices() "+f.length); 
for (int i = 0; i < f.length; i++) 
{ 
    System.out.println(" device name is : "+fsv.getSystemDisplayName(f[i])); 
} 

我也試過Jmtp.jar以獲得下面的代碼的PortableDevice。

PortableDeviceManager manager = new PortableDeviceManager(); 
if(manager!=null) 
{ 
    PortableDevice device = manager.getDevices()[0]; 
    // Connect to my mp3-player 
    device.open(); 

    System.out.println(device.getModel()+" and name"+ 
      device.getFriendlyName()+" and "+device.getDescription(); 
} 

但是Jmtp.jar不支持Mac OS。

有什麼辦法由核心的Java應用程序來獲得在Mac連接iPhone設備...

+0

我的想法:我想你可以寫一些程序來做到這一點,當你有一個真正的問題時,回到這裏。 –

+0

FileSystemView fsv = FileSystemView.getFileSystemView(); \t File [] roots = fsv.getRoots(); \t \t \t 文件\t [] F = File.listRoots(); (int i = 0; i Ifran

+0

我已更新我的問題。 – Ifran

回答

0

如果您使用的是NetBeans然後請訪問以下鏈接。 可能會幫助你 Including Native Library in Netbeans

+0

穆罕默德Raza,感謝您的答覆。這裏Jmtp在窗口中工作得很好,以獲得附加的可移植設備,但它不在Mac中。我想獲得像Java應用程序中顯示的iPhone附加的設備列表。 – Ifran

+0

我也搜索「accesss照片iPhone在Windows/MAC」通過Java。但我覺得這不是爲我工作Jmtp .. –

+0

您可以通過在Windows中使用JMTP獲取連接iphone。我的主要目的是在Mac上連接設備,所以我沒有在窗口中詳細介紹。您必須將jmtp.jar添加到jdk庫/ bin文件夾中的構建路徑和jmtp.dll文件中,而不是運行應用程序。您將通過使用JMTP來獲取iphone。 – Ifran

相關問題