If this is what you need to connect, then the code is as follows:
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 smb-mount, then the code is as follows:
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();
source share