I have a Java game i'm creating and each window is a seperate JFrame with its own components.
How would I get about calling variables from other .java programs? Not quite sure how to do that.
I have a Java game i'm creating and each window is a seperate JFrame with its own components.
How would I get about calling variables from other .java programs? Not quite sure how to do that.
A running JVM instance has no access to objects living in a different instance. Communication between java virtual machines has to be done with other means.
A practical way is to establish a TCP/IP based interface. One application acts as a server (opens a port) and listens to requests for data. TCP/IP based client/server solutions are not too complicated in Java.
Another rather simple alternative is using a shared file on the file system. The data provider updates this file on changes, the 'client' monitors this file and loads the content, whenever it detects update/change (monitor modification timestamp).
And to mention a third approach: Java Management Extensions (JMX) would help too. JConsole (part of the jdk) is a practical example on how to connect to a separate JVM and get access to ('public') data and methods.