This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to set and get a value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "how to set and get a value" Watch "how to set and get a value" New topic
Author

how to set and get a value

saravanan rajendran
Ranch Hand

Joined: Jun 13, 2008
Posts: 75
hello, please guide me i trying this one lot. Actually i have one value in a variable that variable value i have set in one program that same variable value i have to get in another program please help me(i am trying this all in core java)
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3220
Do you mean that they are running in separate JVMs? Why not persist the value to a database or a flat file? Alternatively, need to look at RMI.


Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
saravanan rajendran
Ranch Hand

Joined: Jun 13, 2008
Posts: 75
hi, thanks for reply same jvm only

problem:

program A use to call program B.

i have program A in that i having callerid value that value i have to pass to program B

how to set that callerid value in program A?

how to get that callerid value in program B?

please guide me
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3602
    
  15
You need to be more specific with your terms. You cannot have two programs running in the same JVM. So are we talking about two separate programs (in which case, see arulk's reply) or two processes running as part of the same program ?


Joanne
saravanan rajendran
Ranch Hand

Joined: Jun 13, 2008
Posts: 75
hi thanks for your reply. yes two processes running as part of the same program.

In program A i getting callerid value and calling program B I don't know how to pass the callerid value to program B please guide me
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42035
    
  64
Why did you abandon this thread where you asked essentially the same question and got a lot of help? It wastes the time of people who are trying to help you if multiple simultaneous conversation about the same topic are going on - not a smart thing to do.


Ping & DNS - my free Android networking tools app
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2452
    
    8

Why not have a separate class that set and get the value? Then in your A/B programs can new instance this separate class and do set/get.

If that's not what you want, why not pass the value as parameter into B program. This assumes you set the value inside A locally.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
 
GeeCON Prague 2014
 
subject: how to set and get a value