B4J Question Method not matched

Discussion in 'B4J Questions' started by KentB, Sep 13, 2015.

  1. KentB

    KentB Member Licensed User

    what is wrong when trying to use a jar created with eclipse ?
    package test1;
    import javax.swing.*;
    public final class testclass1 {

    public static void ShowEclipseLibDialog(String[] arg) {
    String st="Welcome to eclipse";
    //this was exported to jar

    Calling from B4J:
    Sub Process_Globals
    Private joEx As JavaObject
    End Sub

    Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    End Sub

    Sub btn1_Action
    joEx.RunMethod("ShowEclipseLibDialog", Array("Message","Title"))
    End Sub

    Results in:
    java.lang.RuntimeException: Method: ShowEclipseLibDialog not matched.
  2. stevel05

    stevel05 Expert Licensed User

    It's saying that the variables you are passing are not in the format that the Method requires. The JavaObject Runmethod requires that you pass the parameters as an Array Object, which you are doing, but you have passed two strings instead of a string array. Try this:

    joEx.RunMethod("ShowEclipseLibDialog"Array(Array As String("Message","Title")))
    Please enclose code blocks in [ CODE] [ /CODE] tags (without the spaces), it makes it much easier to read.
    Last edited: Sep 15, 2015
    PhiloSophical, Erel and Ed Brown like this.
  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