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

Recommended Answers

All 10 Replies

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...

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.

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
?

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!!!

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.

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!

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 =) )

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.

oh, I didn't think about that O.o sorry XD

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.