• Post Reply Bookmark Topic Watch Topic
  • New Topic

Custome Class Loader  RSS feed

 
Badri Sarma
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the advantage of designing Custom Class Loader (Or)
Why Custom Class Loader to be designed?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only reason I've ever had was to set up a classpath from configuration to help load other classes. You could also make them get class files from non-standard places. Any others?
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can allow an end user to pick his own jdbc driver for instance. And if the classes are not found in the library the end user picked, you can tell the end user the library was improper. With existing classloaders, they will just start checking the system classloader for the classes. You may not want the system classloader checked.
 
Paul Clapham
Sheriff
Posts: 22708
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to load a new version of a class when it is available, without having to stop and restart the JVM, a class-loader is essential. (I am not sure what "Custom" means in the original question.)
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd use them whenever you need classes loaded in a different way than the standard classloader provides. Examples might be classes that are not in the classpath, classes that are encrypted on the disk, classes that are loaded from a database or over the network, or classes that are generated from source code.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'd use them whenever you need classes loaded in a different way than the standard classloader provides. Examples might be ... classes that are encrypted on the disk
True, but as this article demonstrates, there is no secure way to do this encryption currently:

http://www.javaworld.com/javaworld/javaqa/2003-05/01-qa-0509-jcrypt.html

Obfuscating class code seems to be more widely adopted.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting article. But it supposes that unencrypted classes are available, which is the case only if the password has been entered (because otherwise no attempts would be made to unencrypt the classes). A determined attacker would buy a license, get a key, and be able to access the bytecode. For against a casual attacker -who might do this in order to avoid paying license fees- the scheme does add additional security. But as you point out, obfuscation should definitely be used as well.
[ June 11, 2006: Message edited by: Ulf Dittmer ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!