Hi Friends, I have this line ctx.put("name", xobj ); in my program1 and I like to call xobj in another program how can I call it in program2(two seperate programs)? Am I clear? thanks, Elahe
Thanks,
Elahe
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
Please clarify your question. Do you mean: I have an object in a HashMap (or similar construct) in one program (object). I want to access that object from a different program (object). How do I do this? Possible Answer: The HashMap in the first program (object) either needs to be constructed with the proper access (public, protected, or default (package)), or you need to create a "get" method in the first program with the proper access (public, ...) that the second program (object) can access. One scenario:
Or do you mean: I type "java Program1" in which I create an object such as an ArrayList. Then I type "java Program2" in another DOS window and try to access the ArrayList you created in Program1 ??
This senario is only possible if you persist your object (save it to the hard drive, for instance).
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Elahe Shafie
Ranch Hand
Joined: Dec 12, 2001
Posts: 291
posted
0
Dirk you got my question right but I didn't get exactly what I have to add to my code? Hope to hear from you so soon... Thanks, ELahe
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
The code examples above demonstrate exactly one thing you could do. Do you have a specific question?