0

is it possible to do such a thing like to get some static data in one java process from another:

I have 2 java applications.

Application 1

public static String hello;
public static void string main(String[] args) {
 hello = "hello";
}

Application 2

public static void string main(String[] args) {
 String hello = someHowTakeInitializedHelloPropertyFromApplication1()
}
asked Sep 8, 2017 at 13:17

1 Answer 1

1

You cannot access objects in the memory space of another process running a JVM. If you need access to any data from another process, make the class that represents that data serializable, and provide an API in the other process to make serialized object available to other processes.

This Q&A discusses options for sharing information across JVMs. For your situation when a very small amount of information needs to be shared, coding a managed bean using Java Management Extensions may be an expedient option.

answered Sep 8, 2017 at 13:23
Sign up to request clarification or add additional context in comments.

1 Comment

Yes, the problem that I want to read the object from another process that is not serializable and I cannot change the implementation of this object. Why i'm trying to do this crazy things because one process instantiate the list of objects taking information from jar files through reflection. The second process is started frequently but it doing the same operation of information loading. (Is just the question of optimization) Good if it possible things I can just to replace loading method procedure in second process what can load already instantiated objects from another process.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.