Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

opening text file using swing

 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I want to open text file which is located on unix system and i want to display text content on swing UI.
when i am tryign to open getting java.io.FileNotFoundException: exception



Any suggestions please.

Thanks,
 
Swastik Dey
Rancher
Posts: 1604
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does textfile.txt exist in the path you have mentioned?
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Swastik, file is present.

Is it possible to open server side file from swing UI ?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably not using the server path - or is the server path mapped to a local path under that name?
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
server path is not mapped in local, problem to map server path in all local systems.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you propose to access files on the server's file system if it's not mapped to the local file system?
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not yet proposed, checking opssibilities and I dont have swing experience. Thanks for help.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Accessing a file has nothing to do with Swing. In order for a program to use a file it must have access to it - via FTP, HTTP, shared directory, WebDAV, or some other way. Start by finding out which way is feasible in your case.
 
Reshma Reddy
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info. i will check feasible way.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48981
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf is quite right. You should use a command‑line application to access a class which can open the file. When you can call getFileContents() on an object of that class and have the text appear on screen, then it will be easy to write a GUI on top which uses the same getFileContents() methid
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic