Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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

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
Ranch Hand

Joined: May 31, 2007
Posts: 3219
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 | profile | Java Interview Books
saravanan rajendran
Ranch Hand

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


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

Joined: Aug 05, 2005
Posts: 3432
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 ?

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

Joined: Mar 22, 2005
Posts: 41180
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

Joined: Sep 13, 2007
Posts: 2247

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.

I agree. Here's the link:
subject: how to set and get a value
Similar Threads
Class Path Problem with windows 7
catalina_home Value ?????
Problem in accessing package variable through trigger
Exception in thread "main" java.lang.NoClassDefFoundError: MyFirstApp. Please help basic issue
Difficulty in setting the class path variable