Wednesday, March 20, 2013

How to execute .class file using servlets


How to execute .class file using servlets

1. If  class in CLASSPATH
it should be in WEB-INF/classes folder or
packaged in jar file located in WEB-INF/lib folder or
in CLASSPATH of your Servlet Container.
Then you can easy create an instance of this class via new operator and call any method.

2. If  class not in CLASSPATH
for example, you receive this class file via HTTP upload or
on runtime you want to change the class com.pack.MyClass with com.pack.MyClass from another location/jar
then you can use dynamic class loading.

http://www.linkedin.com/groups/Hai-How-execute-class-file-70526.S.223081071?view=&gid=70526&type=member&item=223081071&trk=eml-anet_dig-b_nd-pst_ttle-cn

No comments:

Post a Comment