0

I am trying to write a java standalone program that have to read a file from my android device and save it to my windows machine. Please share knowledge on how to do this.

I have tried googleing but havent landed on any thing working yet.

Sanjeevan
  • 67
  • 5
  • Plug your phone into your computer using the charging cable. Set your phone to allow data transfers. Your phone becomes a disk drive under windows. – Gilbert Le Blanc Jul 15 '22 at 16:08
  • The lastest android devices dont have this disk drive. It uses MTP Protocol through which we are not able to access file the normal java way. – Sanjeevan Jul 15 '22 at 16:51

1 Answers1

1

I got this working.

I have downloaded the jar and DDL from this project. https://github.com/jerome-jouvie/jmtp

Add jar to yout project workspace. Here are the steps I followed in eclipse, to add DDL to project.

1.Create a folder under the project, for example dll. 2.Copy/paste all dll files into this folder. 3.In project -> Properties -> Java Build Path -> Source, click and expand the source details. 4.You will see Native library location, click on it. 5.Then click edit on the right, click workspace again. You can see the dll folder under the project. 6.Find it and click Ok. You will see the dll is added in the Native library location.

Post this do the following in run configuration. Say the dll you need is in Y:\path\to\dlls\lib. Then set your Run Configuration's working directory to Y:\path\to\dlls\ and set your VM arguments to include -Djava.library.path=lib

reference: Add .dll to java.library.path in Eclipse/PyDev Jython project

Sanjeevan
  • 67
  • 5