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

Discussion in 'Android Questions' started by xiaoyao, Mar 22, 2015.

  1. xiaoyao

    xiaoyao Member Licensed 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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    The method name is main not MAIN.
     
  3. xiaoyao

    xiaoyao Member Licensed 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?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I'm sorry but I don't understand what you are trying to do.

    tools.jar is not an Android library. It will not work from an Android app.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice