views:

50

answers:

0

I was reading the Flex Compiler API User Guide at http://livedocs.adobe.com/flex/3/compilerAPI_flex3.pdf and tried to follow the example to create a Java application to compile a Flex application.

Here is my program:

import flex2.tools.oem.Application;
import java.io.*;

public class MyAppCompiler {
   public static void main(String[] args) {
      try {
            Application application = new Application(
                      new File("../apps/TestApp.mxml"));
            application.setOutput(new File("../apps/TestApp.swf"));
            long result = application.build(true);
            if (result > 0)
               System.out.println("Compile Success");
            else
               System.out.println("Compile Failed");
          }
      catch (Exception ex){
            ex.printStackTrace();
      }
   }
}

Unfortunately, I get "java.lang.ExceptionInInitializerError" on the very first line.

These are the exact error message in my Eclipse console window:

Exception in thread "main" java.lang.ExceptionInInitializerError 
at myApps.MyAppCompiler.main(MyAppCompiler.java:9)

Caused by: java.lang.NullPointerException 
at flex2.tools.oem.Application. (Application.java:184)

I am using Eclipse 3.3. However, I see the problem when I run my program either from Eclipse or from a command line. Any suggestions would be greatly appreciated.