Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My code throws an error "at java.io.File..ctor(String path)" while I am compressing a file using "java.util.zip" with c# code.
Can any one tell me why this error is throw in below code


java.io.FileOutputStream fos = new java.io.FileOutputStream("c:\zip.zip"); //  J# output


The error is:

"The type initializer for 'java.io.File' threw an exception"
Posted
Updated 14-Nov-10 21:33pm
v3
Comments
Richard MacCutchan 15-Nov-10 8:41am    
Your comment to my suggestion gives no further clue. Try showing the actual line of code that fails.

1 solution

Your string is incorrectly coded, the backslash in a string is used to escape the following character thus you have something other than "\z" in your path name. It should be coded as
"c:\\zip.zip"

or
@"c:\zip.zip"
 
Share this answer
 
Comments
Manoj_0603514007 15-Nov-10 7:24am    
Sorry this iasnot the actual error

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900