Java help Desperatly needed (JFileChooser to be exact)

phaxmohdem

Golden Member
Aug 18, 2004
1,839
0
0
www.avxmedia.com
I got a quick problem, I'm hoping someone can help me solve here. I have written a small app that takes an exported Text file from MS access, and converts the data into a useable HTML form for posting on the web. I"ve got teh conversion stuff working all well and good, however, I am using the JFileCHooser mechanism to select the text file for processing. When I click the browse button, the browse dialogue comes up, I find the file I want and select it, however it only inputs the file name into a text field in my main program: (For example it prints "alweb.txt") I need it to return the full path name like ("C:\text\alweb.txt") or whatever directory it is in.

Can anybody help? It's kind of annoying, I"m failry new to Java BTW, so don't bash me too hard ;)
 

MrChad

Lifer
Aug 22, 2001
13,507
3
81
Can you post some code?

JFileChooser.getSelectedFile() returns a File object. The API documentation explains how to retrieve the path name from a File object.
 

phaxmohdem

Golden Member
Aug 18, 2004
1,839
0
0
www.avxmedia.com
Thanks for the reply MrChad. After looking through the API files and my code for some time, I discovered that I was making the whole program more complicated than it needed to be.. nixed about 10 lines of code, retooled a few other lines and I'm back in business. Program is fixed, but I still could not figure out how to display the whole pathname through it all... Would be interested to know how to just for future reference still. Thanks.
 

boran

Golden Member
Jun 17, 2001
1,526
0
76
fileObject.getCanonicalPathName(); returns the full pathname of a file in a standardized fromat on all platforms.