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
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:
- How can I auto run ccleaner on Mac OS X?Best solution by forum.piriform.com
- How can I make a Spinner only by java?Best solution by stackoverflow.com
- how can I listen for database changes using java?Best solution by Stack Overflow
- How to create a virtual file on mac OS X?Best solution by Super User
- How can I use webcam on my mac on MSN?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.