Not able to compile ActionScript from Java SDK
Posted
by Heang S.
on Stack Overflow
See other posts from Stack Overflow
or by Heang S.
Published on 2010-04-09T14:31:59Z
Indexed on
2010/04/09
14:43 UTC
Read the original article
Hit count: 377
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.
Internally, the error appears to be on the following line:
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.
© Stack Overflow or respective owner