chrisrulz911
Forum Addict
- Joined
- Nov 1, 2005
- Sythe Gold
- 0
- Messages
- 288
I've been trying to solve this problem for the past hour, and to no avail. This is the segment of code I'm working with:
What it does it takes a String name from the ArrayList scriptNames, and tries to instantiate a class and add it to the ArrayList myScripts
The major goal is to go into a directory that contains java files, and allow the instantiation of any one of them. I managed to make a method that gives me the names of the java files in the directory, but I am stumped on the instantiation of the class.
Any help would be appreciated!
Code:
public void loadScripts(){
for(int i = 0; i < scriptNames.size(); i++){
Class c = Class.forName(scriptNames.get(i));
myScripts.add(c);
}
}
The major goal is to go into a directory that contains java files, and allow the instantiation of any one of them. I managed to make a method that gives me the names of the java files in the directory, but I am stumped on the instantiation of the class.
Any help would be appreciated!

