-
June 15th, 2008, 01:55 PM
#1
dynamically executing java code
if a user submits their .java file to my online website, how could i make my java application automatically execute this code?
my java application runs on an aplet, and the things users submit are computer players for a game competition
-
June 15th, 2008, 02:21 PM
#2
Re: dynamically executing java code
If they are submitting .java files (source code), you need to compile it before you can run it.
Check out the Compiler API - see JSR 199: Programmatic Compiling and Programmatic Compilation.
Once you've got the code compiled, you should be able load the class files with a class loader and run it in your own application.
Sounds easy, doesn't it? I bet it isn't...
The cheapest, fastest, and most reliable components of a computer system are those that aren't there...
G. Bell
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
June 16th, 2008, 11:24 AM
#3
Re: dynamically executing java code
This classloaders tutorial shows an example of using classloaders by writing a sample program that compiles and runs code on the fly. This may just provide the basis of what you want.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|