Compile your Apex in Developer Edition or sandbox organizations.
CompileClassResult[] = compileClasses(string[] classList);
Use this call to compile Apex classes in Developer Edition or sandbox organizations. Production organizations must use compileAndTest().
This call supports the DebuggingHeader and the SessionHeader. For more information about the SOAP headers in the API, see the SOAP API Developer's Guide.
public void compileClassesSample() { String p1 = "public class p1 {\n" + "public static Integer var1 = 0;\n" + "public static void methodA() {\n" + " var1 = 1;\n" + "}\n" + "public static void methodB() {\n" + " p2.MethodA();\n" + "}\n" + "}"; String p2 = "public class p2 {\n" + "public static Integer var1 = 0;\n" + "public static void methodA() {\n" + " var1 = 1;\n" + "}\n" + "public static void methodB() {\n" + " p1.MethodA();\n" + "}\n" + "}"; CompileClassResult[] r = new CompileClassResult[0]; try { r = apexBinding.compileClasses(new String[]{p1, p2}); } catch (RemoteException e) { System.out.println("An unexpected error occurred: " + e.getMessage()); } if (!r[0].isSuccess()) { System.out.println("Couldn't compile class p1 because: " + r[0].getProblem()); } if (!r[1].isSuccess()) { System.out.println("Couldn't compile class p2 because: " + r[1].getProblem()); } }
Name | Type | Description |
---|---|---|
scripts | string* | A request that includes the Apex classes and the values for any fields that need to be set for this request. |
* Link goes to the SOAP API Developer's Guide.