My real problem is I created a jar and tried to get a file with the File file=new File(url.toURI()) which created problems. One solution was using an InputStream to read the file, but how do I get it to file format?
And if it makes any difference, its an excel file.
And I mean file=new File(txt);
Message was edited by:
blackmage
So. You have a jar file with an Excel file. And you want to launch Excel with this file do you?
Well there will be no magic conversion here. You need to extract the file from the jar. Save it somewhere as a file. Use the newly created file to launch Excel (I suppose with Desktop or something).
File isn't really a format, but I see what you mean.
There must be a thousand examples of this in the various I/O tutorials. Basically, taking your File object, create a java.io.FileOutputStream. Then create a buffer of bytes. Then in a loop, read a buffer of data from the InputStream, and write it to the OutputStream. Repeat until there are no more bytes to read.
Poke around the I/O tutorials on this site and you'll find an example pretty quick.