jeudi 10 décembre 2015

How to invoke a Java class of another Jar file?

I would like to receive the results dynamically invoke a class in another jar.

For example,

'A' directory in a file named A.jar.

'B' directory in a file named B.jar.

I want to dynamically invoke a class of A.jar file to B.jar file.

This is the main class of A.jar file.

Socket and RMI are not considered because the message exchange technology.

Main Class (B.jar)

public class main {
public static void main(String[] args) {
    //It creates an object of a Message Class in A.jar.
    //And it calls the getMessage function.
    //And Save the return value.

}}

Message Class (A.jar)

public class message{
    public String getMessage(){ 

       return "Hello!";
    }
}





Aucun commentaire:

Enregistrer un commentaire