0

Hello, for the project I'm working on, I need to be able to access say, a JPanel object that was created from the execution of a Jar file, and use it inside another class outside of the Jar file. Any ideas?

Thanks

3
Contributors
10
Replies
11
Views
8 Years
Discussion Span
Last Post by llemes4011
0

I was thinking, and that's pretty much saying the same as, "I want to take an object running on one virtual machine and send it to another virtual machine", right? So, I could use sockets to send the object, but I think that would be slower than what I want to do...

0

Hello, for the project I'm working on, I need to be able to access say, a JPanel object that was created from the execution of a Jar file, and use it inside another class outside of the Jar file. Any ideas?

Thanks

If you want to access any object, you need to have a method that returns it. If you want to use the classes and methods that are in jar you need to put the jar to your classpath.

0

Please clarify:
Do you want to start the program in the jar, the start a second program that accesses objects from the jar program
or
do you want to write one program that includes and uses the classes in the jar
?

0

Please clarify:
Do you want to start the program in the jar, the start a second program that accesses objects from the jar program
or
do you want to write one program that includes and uses the classes in the jar
?

ah, I'm sorry. I want to start the program that's in the jar file, then start a second prrogram thar accesses objects from the 1st program.

Sorry about that!!!

0

I don't know if they are the best possible solution, but I do know that Sockets work very well for that kind of thing. You can pass objects as you suggested, but I don't think that will include the links to an actual open on-screen window. Rather than pass the object you may be better off adding the necessary interface methods to the jar and using RMI to call them.

0

So, by using RMI, will it return the object, or does it just call void methods? also, do you have any good links for learning RMI?

Thanks!

0

Awesome, that should work a lot better! Thanks for the info!
(I'm going to keep this thread un-solved incase I have more questions =) )

0

Suggest you close this thread, and if you have a new question, start a new thread with a suitable title so people can see what's relevant or interesting.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.