bisketraja Posted April 11, 2016 Report Posted April 11, 2016 How to access a file in a Network drive(Z:\\) using java? From windows, I can just use the path \\Z\\folder\\file.pdf but after deploying to the Tomcat server(Linux), it does not work. Any tools I can use to access the Network drive from linux using java? Quote
dewarist Posted April 11, 2016 Report Posted April 11, 2016 linux lo drive letters undav kada. aa network drive em mount point lo mount chesado choosukoni access cheyali for ex : /mnt/fileshare/.... Quote
bisketraja Posted April 11, 2016 Author Report Posted April 11, 2016 30 minutes ago, dewarist said: linux lo drive letters undav kada. aa network drive em mount point lo mount chesado choosukoni access cheyali for ex : /mnt/fileshare/.... yeah bhayya..kani mad vadu a drive ni mount cheyyale. Nenu JCIFS ani oka library undi danni use chesi try chesthunna UNC paths kosam. Currently stuck at this point NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user:pwd); Autherntication failure ani vasthundi. NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("domain", user, pwd); use cheddam antey domain ami ivvalo teleetla. Quote
uncertainty Posted April 11, 2016 Report Posted April 11, 2016 This worked for me.. it shd work for u.... Just example: create a folder called C:\data\june\2010... in your java code just write /data/june/2010 and access it Quote
compose Posted April 11, 2016 Report Posted April 11, 2016 9 minutes ago, bisketraja said: yeah bhayya..kani mad vadu a drive ni mount cheyyale. Nenu JCIFS ani oka library undi danni use chesi try chesthunna UNC paths kosam. Currently stuck at this point NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user:pwd); Autherntication failure ani vasthundi. NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("domain", user, pwd); use cheddam antey domain ami ivvalo teleetla. domain ni blank ivvadaniki try cheyi... or normal ga ni Windows machine lo login ayetappudu edithe domain use chestharo danitho try cheyi... Quote
compose Posted April 11, 2016 Report Posted April 11, 2016 also jcifs use cheyali ante smb networking protocol enable ayi undali Quote
bisketraja Posted April 11, 2016 Author Report Posted April 11, 2016 1 hour ago, compose said: also jcifs use cheyali ante smb networking protocol enable ayi undali 2 hours ago, compose said: domain ni blank ivvadaniki try cheyi... or normal ga ni Windows machine lo login ayetappudu edithe domain use chestharo danitho try cheyi... Thanks bhayya, Domain blank istey work ayyindi. path = "smb://networkName/folderName/fileName.txt"; SmbFile sFile = new SmbFile(path, auth); SmbFileOutputStream sfos = new SmbFileOutputStream(sFile); sfos.write(fileContent.getBytes()); create cheyyadaniki paina code use chesthunna. fileName.txt okay kani fileName.pdf ani istey pdf create avthundi gani opening ravatla. File already in use ani vasthundi. Any ideas?? Basic ga na daggara file content antha html lo undi. Adi pdf loki convert chesi danni shared drive lo pettali. Quote
compose Posted April 11, 2016 Report Posted April 11, 2016 3 hours ago, bisketraja said: Thanks bhayya, Domain blank istey work ayyindi. path = "smb://networkName/folderName/fileName.txt"; SmbFile sFile = new SmbFile(path, auth); SmbFileOutputStream sfos = new SmbFileOutputStream(sFile); sfos.write(fileContent.getBytes()); create cheyyadaniki paina code use chesthunna. fileName.txt okay kani fileName.pdf ani istey pdf create avthundi gani opening ravatla. File already in use ani vasthundi. Any ideas?? Basic ga na daggara file content antha html lo undi. Adi pdf loki convert chesi danni shared drive lo pettali. try like this path = "smb://networkName/folderName/fileName.txt"; SmbFile sFile = new SmbFile(path, auth); SmbFileOutputStream sfos = new SmbFileOutputStream(sFile); byte[] buff=new byte[1024]; int len; while((len=sfis.read(buff))>=0) { //here sfis is referring to the FileInputStream object sfos.write(buff,0,len); } 1 Quote
ipaddress0 Posted April 13, 2016 Report Posted April 13, 2016 On April 11, 2016 at 7:15 PM, compose said: try like this path = "smb://networkName/folderName/fileName.txt"; SmbFile sFile = new SmbFile(path, auth); SmbFileOutputStream sfos = new SmbFileOutputStream(sFile); byte[] buff=new byte[1024]; int len; while((len=sfis.read(buff))>=0) { //here sfis is referring to the FileInputStream object sfos.write(buff,0,len); } evvar thalle nuv... adigina prathidaniki answer isthav... nak .net la doubts osthe bhi septhava finky fafa Quote
Spartan Posted April 13, 2016 Report Posted April 13, 2016 On 4/11/2016 at 4:15 PM, compose said: try like this path = "smb://networkName/folderName/fileName.txt"; SmbFile sFile = new SmbFile(path, auth); SmbFileOutputStream sfos = new SmbFileOutputStream(sFile); byte[] buff=new byte[1024]; int len; while((len=sfis.read(buff))>=0) { //here sfis is referring to the FileInputStream object sfos.write(buff,0,len); } good fost @compose @pinky1234 Quote
VadaGaali Posted April 13, 2016 Report Posted April 13, 2016 Nenu epudu code rayadam lo intha proficient avtano. Quote
fake_Bezawada Posted April 13, 2016 Report Posted April 13, 2016 On 4/11/2016 at 9:48 PM, bisketraja said: How to access a file in a Network drive(Z:\\) using java? From windows, I can just use the path \\Z\\folder\\file.pdf but after deploying to the Tomcat server(Linux), it does not work. Any tools I can use to access the Network drive from linux using java? property file pettukuni andhulo modify chesukomanu location ni appudu code change lekunda just property file lo property change chesukunte chalu Quote
fake_Bezawada Posted April 13, 2016 Report Posted April 13, 2016 already suggestion vatchesindha Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.