• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Writing Your Own Class Loader

 
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you want to do it? I can think of a few possibilities, although they don't seem too compelling. I'm interested in different reasons why a person would want to write their own class loader.

With Respect,
Matt
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reason is very simple; you can dynamic way change class_path and you can even encrypt your java class byte code then loading class using your own class loader, and so forth.
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm...thanks for your response, and perhaps I don't understand you fully, but if I do, I respectfully think there must be more to it than that. You are saying that one of the reasons is so you can dynamically set your classpath?! That doesn't make sense to me. For one, I don't see that this gains you much (not enough to warrant writing your own class loader), and for two, (for the most part) the way you launch a java app makes this advanatge dubious. The other thing you mentioned about encrypting your classpath...I saw that proposed in another thread and it was rejected as a good use for a class loader. I can't decide if it is or not, but it does seem to me that your class loader itself would have to be unencrypted and that the unecrypted class loader could be "decompiled" and then a hack could see what key you were decrypting with and use that same key. Am I missing something? There must be a more compelling reason to write your own class loader.

With Respect,
Matt
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me take a crack at answering this question... My knowledge on the subject is superficial so don't take anything I say too literally. Here goes...
Many of the IDE's such as JBuilder, etc use custom classloaders to encrypt the .exe file so that no one can run them. Once you purchase the product, however, you receive a key. This key is used to decrypt the .exe file so that the .exe can run.
There's a pretty good discussion of this in the Core Java 2 (Volume II) book on ppg 862-870.
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic