Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

reload static method to reinitialize variables

807603Dec 20 2007 — edited Dec 20 2007
I have a class (from an outside package) that uses a static main method to perform a task. I'd like to call this class multiple times with different arguments (passed in as args to the main). However, just calling the main multiple times doesn't seem to work since it is being used within the package to initialize other variables in other classes, and these aren't getting cleared or reset when I run the class with the main method.

I'm sure this is simple, but I haven't seen a way around it yet. I tried use ProcessBuilder, but that seems overly complicated and I'd like to keep within the java environment rather than reaching out to the OS.

I'm using java SE 5.0.

Hope this makes sense.
steve
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 17 2008
Added on Dec 20 2007
3 comments
628 views