I have a client application and a server application. The server, using JNA, is a wrapper for some dll's I need to use because and long story short there is not enough memory to run both the client and server logic in a 32-bit JVM, hence the separate applications.
I need to be able to share memory between these two applications - specifically, I need to be able to send pointers from one to the other and vice versa. I know that I can execute the runnable JAR for the server from within the client jar - as a separate process. But is it possible to execute it as part of the same process, just on a different thread? That way I might be able to send pointers from one to the other.
Here's a bit of background:
Sending a JNA Pointer from one Java application to another Java application
Yes it is possible. Sort of.
Method
object for main(String[])
Method.invoke(...)
to call it with the appropriate "command line" arguments.The problem is that when you do this the application that you have started will share the standard i/o streams with the original one, as well as things like the system properties, default charset, default timezone and so forth.
And I don't think this is going to solve your "not enough memory" or "not enough address space" problems.
And finally, a 64 bit JVM cannot load 32 bit DLLs or vice versa.
One possible alternative might be to use shared memory: