wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes How can I call my obj in another program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How can I call my obj in another program?" Watch "How can I call my obj in another program?" New topic
Author

How can I call my obj in another program?

Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
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
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:


Making any sense? Getting any ideas?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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
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
The code examples above demonstrate exactly one thing you could do. Do you have a specific question?
Elahe Shafie
Ranch Hand

Joined: Dec 12, 2001
Posts: 291
Got it.
Thank you so much
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Great!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I call my obj in another program?
 
Similar Threads
I try to get whole row from database but...
How can I see my record?
Please help....confused:
number of rows Resultset ???
How can I solve IllegalArgumentException