0

The Problem I am trying to solve is how to execute a Java file (.java extension) or a whole jar (.jar) during runtime from within a java program. The Class / Jar will be sent over Network in order to distribute workload.

My question is what is the best approach. It should be possible to quickly type some code in GUI and let it be executed and/or write large bulk of code in a file and let it be executed. Thus, I need to Compile it and then run it.

So what would be the best approach to this problem in Java ?

PS: sorry for my bad englisch

1

1 Answer 1

0

the Java world relies on Maven heavily to distribute packages: https://maven.apache.org/

  1. Create a .jar file distribution with maven: https://www.mkyong.com/maven/how-to-create-a-jar-file-with-maven/
  2. Publish this .jar file to maven central: https://maven.apache.org/repository/index.html

From there, you can re-import it in your client code.

Sign up to request clarification or add additional context in comments.

1 Comment

It sounds like Lucas wants to do this at run time, not build time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.