Results 1 to 2 of 2
Thread: FileNotFoundException problem
- 04-19-2010, 11:03 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 48
- Rep Power
- 0
FileNotFoundException problem
i built one program to save/create JTable as (.file) extension by using ObjectOutputStream... but once i need to read by using JFileChooser it prints FileNotFoundException:
if i use direct file-path then working nicely..java.io.FileNotFoundException: file.file (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method
how can i solve this ?Java Code:JFrame frame=new JFrame(); JTable table; JFileChooser fc = new JFileChooser("C:/Java/CLASS"); fc.setFileSelectionMode(JFileChooser.FILES_ONLY ); int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { File file=fc.getSelectedFile(); String filename= file.getName(); //String filename=("C:/Java/CLASS/file.file"); try { FileInputStream fis=new FileInputStream(filename); ObjectInputStream ois=new ObjectInputStream(fis); table = (JTable) ois.readObject(); JScrollPane jsc=new JScrollPane(table); frame.add(jsc); frame.setSize(500,700); frame.setVisible(true);what we are thinking, it might not be true
- 04-19-2010, 11:07 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Similar Threads
-
FileNotFoundException
By ProgrammingPup in forum Advanced JavaReplies: 4Last Post: 12-30-2009, 01:29 AM -
filenotfoundexception :@
By wildheart in forum New To JavaReplies: 2Last Post: 04-25-2009, 09:56 AM -
handle FileNotFoundException
By minifish in forum New To JavaReplies: 13Last Post: 11-08-2008, 02:01 AM -
java.io.FileNotFoundException
By thevoice in forum New To JavaReplies: 5Last Post: 06-13-2008, 08:38 AM -
FileNotFoundException
By PeonLover in forum New To JavaReplies: 1Last Post: 12-26-2007, 06:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks