How dynamically createload new classes in java?Listing classes in a jar fileHow do I efficiently iterate over each entry in a Java Map?Java inner class and static nested classHow do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How can I create an executable JAR with dependencies using Maven?How do I determine whether an array contains a particular value in Java?How do I create a file and write to it in Java?How do I convert a String to an int in Java?Creating a memory leak with Java
Alphametics puzzle, given numbers that are prime and square.
Why did they avoid parodying Martian Manhunter?
Dealing with an extrovert co-worker
Can you pop_back a vector and still use the iterator to the last element?
Pythagorean triple with hypotenuse a power of 2
Would it be possible to have a GMO that produces chocolate?
How to make Ubuntu support single display 5120x1440 resolution?
Did the British navy fail to take into account the ballistics correction due to Coriolis force during WW1 Falkland Islands battle?
How do you harvest carrots in creative mode?
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
I don't have the theoretical background in my PhD topic. I can't justify getting the degree
How to prevent clipped screen edges on my TV, HDMI-connected?
Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?
Round towards zero
Confirming resignation after resignation letter ripped up
Who was president of the USA?
Are modern clipless shoes and pedals that much better than toe clips and straps?
Is “I am getting married with my sister” ambiguous?
How to gently end involvement with an online community?
How to respectfully refuse to assist co-workers with IT issues?
“T” in subscript in formulas
Is for(( ... )) ... ; a valid shell syntax? In which shells?
Avoiding racist tropes in fantasy
What is the difference between Major and Minor Bug?
How dynamically createload new classes in java?
Listing classes in a jar fileHow do I efficiently iterate over each entry in a Java Map?Java inner class and static nested classHow do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How can I create an executable JAR with dependencies using Maven?How do I determine whether an array contains a particular value in Java?How do I create a file and write to it in Java?How do I convert a String to an int in Java?Creating a memory leak with Java
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a simpe Swing application for drawing different shapes (circle, triangle, square and etc.). It works like that: you have to choose shape type, click somewhere in the apllication window and get the chosen shape drawn where you clicked. And I have to add a functionality that allows to add new shapes (classes) on the runtime via plugin.
Plugin is a file that somehow describes a new shape (class) and its functionality and exists somewhere in the system (in some folder).
My question: what is the best way to implement this? What approaches, libraries and sources can you recommend?
I have found some information about JPF (Java Plug-in Framework), but I'm not sure that this is what I need becaust it looks quite enormous and seems to be used for other purposes (maybe I'm wrong).
Thank you.
java dynamic plugins runtime
add a comment |
I have a simpe Swing application for drawing different shapes (circle, triangle, square and etc.). It works like that: you have to choose shape type, click somewhere in the apllication window and get the chosen shape drawn where you clicked. And I have to add a functionality that allows to add new shapes (classes) on the runtime via plugin.
Plugin is a file that somehow describes a new shape (class) and its functionality and exists somewhere in the system (in some folder).
My question: what is the best way to implement this? What approaches, libraries and sources can you recommend?
I have found some information about JPF (Java Plug-in Framework), but I'm not sure that this is what I need becaust it looks quite enormous and seems to be used for other purposes (maybe I'm wrong).
Thank you.
java dynamic plugins runtime
I would put the custom shape classes in a jar, and implement functionality in your main app to select and load the jar (see URLClassLoader). You can also inspect the classes in the jar using the example given here: stackoverflow.com/questions/3429275/…
– ControlAltDel
Mar 27 at 17:43
You could use ServiceLoader as described in the docs for [Creating Extensible Applications ](docs.oracle.com/javase/tutorial/ext/basics/spi.html).
– dnault
Mar 27 at 19:22
add a comment |
I have a simpe Swing application for drawing different shapes (circle, triangle, square and etc.). It works like that: you have to choose shape type, click somewhere in the apllication window and get the chosen shape drawn where you clicked. And I have to add a functionality that allows to add new shapes (classes) on the runtime via plugin.
Plugin is a file that somehow describes a new shape (class) and its functionality and exists somewhere in the system (in some folder).
My question: what is the best way to implement this? What approaches, libraries and sources can you recommend?
I have found some information about JPF (Java Plug-in Framework), but I'm not sure that this is what I need becaust it looks quite enormous and seems to be used for other purposes (maybe I'm wrong).
Thank you.
java dynamic plugins runtime
I have a simpe Swing application for drawing different shapes (circle, triangle, square and etc.). It works like that: you have to choose shape type, click somewhere in the apllication window and get the chosen shape drawn where you clicked. And I have to add a functionality that allows to add new shapes (classes) on the runtime via plugin.
Plugin is a file that somehow describes a new shape (class) and its functionality and exists somewhere in the system (in some folder).
My question: what is the best way to implement this? What approaches, libraries and sources can you recommend?
I have found some information about JPF (Java Plug-in Framework), but I'm not sure that this is what I need becaust it looks quite enormous and seems to be used for other purposes (maybe I'm wrong).
Thank you.
java dynamic plugins runtime
java dynamic plugins runtime
asked Mar 27 at 17:38
CoffemanzCoffemanz
436 bronze badges
436 bronze badges
I would put the custom shape classes in a jar, and implement functionality in your main app to select and load the jar (see URLClassLoader). You can also inspect the classes in the jar using the example given here: stackoverflow.com/questions/3429275/…
– ControlAltDel
Mar 27 at 17:43
You could use ServiceLoader as described in the docs for [Creating Extensible Applications ](docs.oracle.com/javase/tutorial/ext/basics/spi.html).
– dnault
Mar 27 at 19:22
add a comment |
I would put the custom shape classes in a jar, and implement functionality in your main app to select and load the jar (see URLClassLoader). You can also inspect the classes in the jar using the example given here: stackoverflow.com/questions/3429275/…
– ControlAltDel
Mar 27 at 17:43
You could use ServiceLoader as described in the docs for [Creating Extensible Applications ](docs.oracle.com/javase/tutorial/ext/basics/spi.html).
– dnault
Mar 27 at 19:22
I would put the custom shape classes in a jar, and implement functionality in your main app to select and load the jar (see URLClassLoader). You can also inspect the classes in the jar using the example given here: stackoverflow.com/questions/3429275/…
– ControlAltDel
Mar 27 at 17:43
I would put the custom shape classes in a jar, and implement functionality in your main app to select and load the jar (see URLClassLoader). You can also inspect the classes in the jar using the example given here: stackoverflow.com/questions/3429275/…
– ControlAltDel
Mar 27 at 17:43
You could use ServiceLoader as described in the docs for [Creating Extensible Applications ](docs.oracle.com/javase/tutorial/ext/basics/spi.html).
– dnault
Mar 27 at 19:22
You could use ServiceLoader as described in the docs for [Creating Extensible Applications ](docs.oracle.com/javase/tutorial/ext/basics/spi.html).
– dnault
Mar 27 at 19:22
add a comment |
1 Answer
1
active
oldest
votes
Java can have a feature called reflection API. By using this, you can create objects dynamically at run time. We can call their methods at runtime
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383435%2fhow-dynamically-create-load-new-classes-in-java%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Java can have a feature called reflection API. By using this, you can create objects dynamically at run time. We can call their methods at runtime
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
add a comment |
Java can have a feature called reflection API. By using this, you can create objects dynamically at run time. We can call their methods at runtime
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
add a comment |
Java can have a feature called reflection API. By using this, you can create objects dynamically at run time. We can call their methods at runtime
Java can have a feature called reflection API. By using this, you can create objects dynamically at run time. We can call their methods at runtime
answered Mar 27 at 17:49
Manjunath Jogi H kManjunath Jogi H k
11 bronze badge
11 bronze badge
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
add a comment |
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
Yeah, I know about reflection. But what if a plugin not just a java class. Let's say it has some custom format.
– Coffemanz
Mar 27 at 17:50
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383435%2fhow-dynamically-create-load-new-classes-in-java%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I would put the custom shape classes in a jar, and implement functionality in your main app to select and load the jar (see URLClassLoader). You can also inspect the classes in the jar using the example given here: stackoverflow.com/questions/3429275/…
– ControlAltDel
Mar 27 at 17:43
You could use ServiceLoader as described in the docs for [Creating Extensible Applications ](docs.oracle.com/javase/tutorial/ext/basics/spi.html).
– dnault
Mar 27 at 19:22