Question

I tried to zip files(ie.images,txt,doc....) in c# and tried this (which gives a answer by using J#)

 using java.io;
 using Java.util.zip;

 \\part of code which throws exception
 private void button1_Click(object sender, EventArgs e)
    {
      Zip(@"D:\Zipped.zip",new string[]{"ico_1.ico","readme.txt"});
    }
 private void Zip(string zipFileName, string[] sourceFile)
    {
      FileOutputStream filOpStrm = new FileOutputStream(zipFileName);

Exception message:

'The type initializer for 'java.io.File' threw an exception.'

I found that the problem is on FileOutputStream .. But, cant find a way to to solve it.. And all i want is a solution to solve this issue and reason for this Exception....

No correct solution

OTHER TIPS

Debug it! Debug the code line by line in IDE, then you can know which line throw this exception.

When a class initializer fails to initialize a type, a TypeInitializationException is created and passed a reference to the exception thrown by the type's class initializer. The InnerException property of TypeInitializationException holds the underlying exception.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top