-1

I have such Java object:

public class MyObject {

    private Integer counter = 0;

    public void increment() {
        this.counter++;
    }

// Getters, setters

}

In main() method i am calling method increment():

public class Main {

    public static void main(String[] args) {
        MyObject obj = new MyObject();
        obj.increment(); // i want to call this line in python script
        // do something more
    }

}

Now let's image I want to pass MyObject instance in main() method to Python script which will call increment() method on passed MyObject instance. What is the eaziest way to do this?

EazyH
  • 57
  • 6

1 Answers1

0

You should implement Signal handler in java:

http://twit88.com/blog/2008/02/06/java-signal-handling/

Then you should send Signal in python to your process in java:

How can I send a signal from a python program?

Signal a process is one of the easiest way to communicate between process.

Idan Str
  • 614
  • 1
  • 11
  • 33