Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create a temp directory that is kept inside a jar file

807599Feb 6 2007 — edited Feb 6 2007
My code for creating a temp file kept inside the jar file is working fine
InputStream is=Main.class.getClass().getResourceAsStream("/temp/test.txt");
File dstfile=File.createTempFile("test", ".txt");
FileOutputStream fos = new FileOutputStream(dstfile);
int b;
while((b = is.read()) != -1) 
{
	fos.write(b);
}
fos.close();
In the same manner, I need to create a temp directory with all the files inside it. To do this could anyone please tell me what do I modify in my above code.

Message was edited by:
Simmy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 6 2007
Added on Feb 6 2007
6 comments
361 views