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;








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.










share|improve this question
























  • 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

















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.










share|improve this question
























  • 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













0












0








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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

















  • 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












1 Answer
1






active

oldest

votes


















0















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






share|improve this answer

























  • 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











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



);













draft saved

draft discarded


















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









0















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






share|improve this answer

























  • 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
















0















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






share|improve this answer

























  • 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














0














0










0









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






share|improve this answer













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







share|improve this answer












share|improve this answer



share|improve this answer










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


















  • 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









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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현