Here is the thing, I want to build a system that shall take an external executable jar( later any .exe as such/ can be extended to API, but that's very long term) to a local Java executable(let's call it the Engine) at execution time. I'm thinking like to pass the name of the jar(let's call it the plugin) to the Engine, there would be a standard method for communication when conformed, both the Engine and Plugin would communicate. How can I do that without building a lot from scratch. I'm thinking in a very bookish way, can I use/study any existing method/framework. My whole system is built in Java so I am bound by the language mostly.
Asked
Active
Viewed 67 times
0
-
How `import external.executable.jar` do not solve your problem? – Victor Polo De Gyves Montero Apr 29 '21 at 16:26
-
I want to do it in execution time, like an argument. – Arunavo Apr 29 '21 at 16:27
-
Use URLClassLoader and Class.forName – Victor Polo De Gyves Montero Apr 29 '21 at 16:29
-
Ok. I'll check that. Thanks. – Arunavo Apr 29 '21 at 16:30
-
Does this answer your question? [Java: Get a class from an external .jar](https://stackoverflow.com/questions/9881393/java-get-a-class-from-an-external-jar) – Victor Polo De Gyves Montero Apr 29 '21 at 16:30
-
Might not. Because to be exact this is what it looks like in a very rough way, At execution, I want to pass like java -jar Engine.jar Plugin.jar and then these two shall communicate. – Arunavo Apr 29 '21 at 16:33
-
What you are referring to is probably reflection which I'm not yet sure if this would solve my issue or not. For that, I came here to get some leads. – Arunavo Apr 29 '21 at 16:36
-
Give it a test, read the documentation of these classes/methods. It is expected on your side to try and research what it is suggested before hasting conclusions. – Victor Polo De Gyves Montero Apr 29 '21 at 16:44
-
Sure, I'll check. – Arunavo Apr 29 '21 at 16:46
-
You are trying to reach several different things with your question: One is how to load a class from an external jar (I have already provided to you a few tips to solve that one), the other is how to *add an external jar into the execution of a java program*, I'd suggest you open up a different question for that one once you know how to solve the first part of the problem. – Victor Polo De Gyves Montero Apr 29 '21 at 16:47
-
Yup, let me see in detail. There are few things I might put up as constraints too in the application, like a signature for the Plugin file. I'll do some more research and update this post. Thanks for the cue. – Arunavo Apr 29 '21 at 16:51