0

I have a String which contains the source code of an entire java class. My intention is to create a new class in another project folder using the code in this String. All this is to be done by code, not manually.

Is this possible in Java?

1
  • You need to checkout ClassLoaders Commented May 8, 2013 at 11:35

2 Answers 2

3

Since you are using String, I'm assuming you are talking about a class in Java source code form. If you are targeting JRE 1.6 or higher, you can use the JavaCompiler interface for turning this source code into a compiled Java class.

See Java API documentation.

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

Comments

1

Here are some usefull link

Comments

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.