caching - Reflection in Java: How do I create objects of different types with the same name? -


I am writing an auto-grader for my students code. Each student class is called the same thing (selection), they are all in the same folder

I have tried:

  • I am trying to figure out how the object To reset, know that when I make a new one, it actually uses a new one. Removing the original class, and compiling it again
  • Write another class that I compile every time (testFile1.java compiles and testFile2.java calls, which actually creates each select object ).

The problem is that the Java class caches the object of the class, so every time I run it, it uses the first selection class instead of the newly compiled one is.

My question is: how can I reset Java to get rid of caching of a class in Java so that when I compile the same file with the same file, it actually Will you use the new object type? / P>

I recommend that you put them in different folders, or in the temporary folder if you have them Are processing at the pawr.

If you want to load a new version of the class without restarting your JVM, you have put the class in a different class loader.

However, if a student does a hockey, other students can stop the code from walking. The best way to avoid this is to run every replacement in your own JVM, to avoid contamination. for.

For example, change "Hello" to print (integer) 0 to > (integer) 1 or "G'Day" Imagine what you can do;)


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -