How can I mount a network drive in Mac OS X in Java?

How can I mount network drive in Mac OS X on Java?

  • I am writing a programme on JBuider 2005 on Windows XP platform for Mac OS X. Programme must launch on Mac OS X and programme turnes(directs) to share folders on other computer(Windows XP) in network. It is necessary that then we launch nprogramme on Mac OS X this programme automatically mount these share folders under Mac OS X. Then programme turnes to files on share folder and path in program will be "/Volumes/Share folder/File". How can i make it? Help, if anyone knows how to do it.

  • Answer:

    Perhaps run a bit of AppleScript which has Finder mount the shared folder. This http://www.mactech.com/articles/mactech/Vol.21/21.04/AppleScriptandJava/index.html describes running AppleScript from a Java program. Or run a shell script: mount -t smbfs //user@server/share folder

Anonim at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

If it is a afp-volume that you have to mount, the code looks like this: Process p1 = Runtime.getRuntime().exec("/bin/mkdir /Volumes/<mountName>"); p1.waitFor(); Process p2 = Runtime.getRuntime().exec(new String[] {"/sbin/mount_afp","-i","afp://<user>:<passwd>@url.of.serv.er/mountPath/","/Volumes/<mountName>/"}); p2.waitFor(); If it is a smb-mount, then the code looks like this: Process p3 = Runtime.getRuntime().exec("/bin/mkdir /Volumes/<mountName>"); p3.waitFor(); Process p4 = Runtime.getRuntime().exec(new String[] {"/sbin/mount","-t","smbfs","//<user>:<passwd>@url.of.serv.er/mountPath/","/Volumes/<mountName>/"}); p4.waitFor();

Erik

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.