Skip to main content

hello all for whom a simple list to path conversion...

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2011-11-15

Hello All;

File[] files = fd.getSelectedFiles();

StringBuilder sb = new StringBuilder();

for (int i = 0; i < files.length; i++)


sb.append(files[i].getPath() + "\n");



This just gets the file and their paths to a list.

I am trying to extract items from this list with;

String Path = list.getItem(0);

But unfortunately i can not convert the string to a filepath...

which i am going to use in;

RenderedImage image = (RenderedImage)JAI.create("fileload",ImPath);

Is there a way?

i looked at some conversions even with stream one but unfortunately it does not allow as a path...

"C:\Users\Public\Pictures\Sample Pictures\1296.jpg"

this is the output from;

String Path = list.getItem(0);

printed to the console as;


String builder is what i used to divide the selection of files with the multi selection. and write them in the list separated from each other. Hope i am using it correctly.

Thanks for a lot of responses.

Kind Regards

ömer kaya


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2012-05-14

you're codes are a bit messy can't understand what you want to achieve.