Android Question how can i call a (MAIN)method from b4a to jar

xiaoyao

Member
Licensed User
Longtime User
public static void main(String[] args) throws Exception {
//
}
how can i call a method from b4a to jar?

I ADD THIS JAR BY : #AdditionalJar: DemoNoMainSub
RunMethodjo("init",Array(AppId,AppSecret,Model))

HOW TO DO LIKE THIS

Private Sub GetManager As JavaObject
Dim jo As JavaObject
Return jo.InitializeStatic("COM.ABC.DD").RunMethod("MAIN", Array(GetContext))
End Sub
 

xiaoyao

Member
Licensed User
Longtime User
i also try with main,but can't do ,can you try?

class1=ClassLoader.getSystemClassLoader().loadClass("com.sun.tools.javac.Main");
Class[] argTypes = new Class[] { String[].class };
String[] mainArgs = {File1};
Method method=class1.getDeclaredMethod("main",argTypes);
method.invoke(class1.newInstance(),(Object)mainArgs);

in windows ,i add tools.jar(jdk file path),it can Compile abc.java to abc.class ,only one args,can it doing on ANDROIS?
 
Upvote 0
Top