• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in reading the excel file path from WINDOWs machine from UNIX environment

 
Lucky Here
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,

my requirement is to read each row of the excel sheet and sent that row to the database. I have implemented it by using jxl and apache poi framework. locally in my WINDOWS machine it is working fine..

But when i deploy the code in UNIX machine. and trying to read the excel file in WINDOWS environment. I am not able to retrieve the file path. for ex : C:\Documents and Settings\sabbanik\My Documents\KARUNAKAR\excel.xls

I am getting error in this line
workbook = Workbook.getWorkbook(filepath)
Error message : input file not found.

Thanks in advance..
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

UNIX does not have a C drive. It has one file system root, /. Everything else falls under it. You can mount other partitions ("disks") under it somewhere.
If the machine is a dual boot with both Windows and some form of UNIX / Linux, you'll need to mount the Windows drive under UNIX / Linux. If they are two different machines you will need to use a separate protocol like SMB.
 
Lucky Here
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply..

you are right, this are two different machines.

Please suggest me some other alternate process to read the filepath of windows from unix environment. my requirement is

1. I want to read all the rows and send them to db
2. If the particular row is submitted successfully, I will to write "SUCCESS" to that last column of the particular row.


Thanks
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you can access the file, you will be able to read it and process its contents just like you would if it were a local file. That means, if you've got that part working on Windows already, then all you have to do is figure out how to get to that file. As Rob suggested that's usually a matter of configuring your network so that your Unix box can see the file system on the Windows box. There's nothing Java can do about that.

Well, not nothing. You could implement an RMI or socket-based file browser and then run the server part on the Windows box and the client part on the Unix box. I suggest getting your network set up though. That's a much easier solution.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a few ways to share files between different PCs. FTP is one. SMB is another, that is supported by both Windows and UNIX. If your environment is UNIX only you can also choose for NFS.

In this case, I suggest SMB. This is the protocol used by standard Windows shares. That means that you have to create a share on the Windows machine.
On the UNIX machine I see two options:
1) mount the SMB share. This turns the share, as far as the UNIX machine is concerned, into a local file. You can then use java.io.File and all related classes.
2) use a library like JCIFS for accessing the SMB share. No share is needed, and your Java program will take care of the communication. You cannot use java.io.File but JCIFS has alternatives for it.

Both options have their pros and cons. Which one you choose is up to you, but the way you want to scale is important here. If you want to be able to switch from an SMB share to local files easily, use the first option. If you will keep using an SMB share and want to access that share from any machine, the second option is better.
 
Lucky Here
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My requirement is almost finished..

first I am taking the excel file to the unix server, there i am reading the excel and writing "SUCCESS" into excel sheet. after that i am planning to save that unix excel copy into my windows machine..

How to save the unix copy in my windows machine ?? Please help me.

Thanks in advance..

 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you even read my previous post? It's not just for Windows -> UNIX but also the other way around.
 
Lucky Here
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ALL,

I have implemented using POI framework.. I have not used JCIFS and SMB.

1. First I have upload the excel in some unix folder.
2. I read the excel and write "SUCCESS" to that excel sheet.
3. By using POI framework and i have open the excel sheet.

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!