[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to access files/folders on a MTP device?

Posted on 2007-10-17
24
Medium Priority
?
3,209 Views
Last Modified: 2008-03-26
On MSWindows XP and Vista, MP3 players nowadays will not be visible
as device lettered partitions, but as 'devices' accessible through a path that begins at 'desktop'.

How do I find that path from JAVA?

;JOOP!
0
Comment
Question by:sciuriware
  • 12
  • 9
  • 3
24 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 20095388
Try

File f = new File(System.getProperty("user.home"), "Desktop");
0
 
LVL 92

Expert Comment

by:objects
ID: 20097417
try:  File.listRoots()
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20098797
CEHJ: that gives me the desktop with only the desktop icons in it.
objects: that gives me all drive letters.

When an MTP device is connected a pop up shows named "Portable Device".
You can double click "Open device to view files using Windows Explorer"
Windows explorer then shows (in case of a Creative ZEN mp3 player):
"Storage Media" at the address "My Computer\My Zen".

A file manager like Total Commander shows in directory tree mode:

[ ] Desktop
- [ ] My Computer
.................
+ [ ] My Zen

How do I get those links?

;JOOP!
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 92

Expert Comment

by:objects
ID: 20098819
> objects: that gives me all drive letters.

I realise that, does it not associate it with a drive?
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20098842
No that's the main problem ever since XP.

;JOOP!
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 20098850
XP didn't have that problem that I ever saw. devices/flash drives got mapped to drive
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20099100
>>CEHJ: that gives me the desktop with only the desktop icons in it.

That will give you the Desktop directory. If that's where the filesystem of the MP3 device is mounted then there shouldn't be a problem although it seems odd it's not being mounted as a file system root
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20101328
CEHJ, if you can lay your hands on a Creative ZEN, you will find out.
For the moment I can only exchange fiules via Windows Explorer.

;JOOP!
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20101343
objects, same message as to CEHJ.
I was surprised too.

Anyway, I can't even see 'My Computer' in my Desktop folder.

;JOOP!
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20101350
P.S.:

Anyway, I can't even see 'My Computer' in my Desktop folder in a JFileChooser{}.

;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20101439
'My Computer' is not a subdirectory, or a shortcut, but i'm not sure what it is
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20106825
That's the point.

;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20106948
Can you post the result of

dir "%USERPROFILE%\Desktop"

?
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20107174
>>>
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>dir "%USERPROFILE%\Desktop"
 Volume in drive C is NutkinSys
 Volume Serial Number is EC0F-456D

 Directory of C:\Documents and Settings\joop\Desktop

04-10-07  17:16    <DIR>          .
04-10-07  17:16    <DIR>          ..
04-04-07  15:01             2 855 Block Out.pif
30-11-05  12:39               564 MAP Kaibab.lnk
02-06-07  17:39               564 MAP Ratufa.lnk
30-11-05  12:40               568 UNMAP Kaibab.lnk
02-06-07  17:40               568 UNMAP Ratufa.lnk
               5 File(s)          5 119 bytes
               2 Dir(s)   2 265 378 816 bytes free

C:\>
<<<

;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20107200
That's a sparse but intriguing desktop ;-) Haven't come across that listing before. Is it listing Out.pif as a Unix-like block device? Could that be the player?
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20107209
Block Out is an MSDOS game.
I wrote my own Program Manager in Java, so my Desktop is a bit empty.
Should I try to put My Computer in there? How?
;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20107240
>>Block Out is an MSDOS game.

Sorry - misread that then. What about MAP and UNMAP?
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20107282
Shortcuts to .bat scripts

;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20107300
All quite strange. So you see an icon representing the player on the desktop
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20107779
No. in the system tray only.

;JOOP!
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20128832
If even objects and CEHJ don't know of a solution, I conclude that such access
must be made through JNI code.

In the mean time I discovered that the latest release of Total Commander (file manager) 7.02
has a command to put my MP3 playerin a pane, even not having a drive letter.
The command is: Command->Open Desktop Directory.

In order to make this solution visible to searchers I will give you some points.
Thanks.
;JOOP!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20129169
Has this got a USB interface?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20129185
Assuming yes, you might try to ignore the FS and go straight to the device using something like:

http://jusb.sourceforge.net
0
 
LVL 24

Author Comment

by:sciuriware
ID: 20133227
Yes it has.
I'll dig into this.

;JOOP!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question