File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes opening text file using swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "opening text file using swing" Watch "opening text file using swing" New topic
Author

opening text file using swing

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
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

Joined: Jan 08, 2009
Posts: 1447
    
    6

Does textfile.txt exist in the path you have mentioned?


Swastik
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Yes Swastik, file is present.

Is it possible to open server side file from swing UI ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41029
    
  43
Probably not using the server path - or is the server path mapped to a local path under that name?


Ping & DNS - my free Android networking tools app
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
server path is not mapped in local, problem to map server path in all local systems.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41029
    
  43
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

Joined: Dec 21, 2006
Posts: 197
It is not yet proposed, checking opssibilities and I dont have swing experience. Thanks for help.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41029
    
  43
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

Joined: Dec 21, 2006
Posts: 197
Thanks for the info. i will check feasible way.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37874
    
  22
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: opening text file using swing
 
Similar Threads
is a JTable always part of exam
How to edit text file in jar
Tabular form data
how to string search ?
how to print the text in text area