开发者

How can I run java code that has been pasted into my program

开发者 https://www.devze.com 2023-03-28 18:01 出处:网络
I\'m making a simulator for Time Complexity. The purpose is that Students can choose which algorithms they want to compare.

I'm making a simulator for Time Complexity. The purpose is that Students can choose which algorithms they want to compare.

But I want to make it possible to compare algorithms they've written themselves. I know how to get it to work with a compiled .class file.

I was wondering whether it is possible for the students to just paste the code (with predefined public methods) and then just run it.

I suppose that I have to do something with javac开发者_运维知识库.

Any ideas are welcome!

Thanks


Use the JavaCompiler class. You will need to add tools.jar to your classpath if you don't already have it.

0

精彩评论

暂无评论...
验证码 换一张
取 消