Basic Security: ClassLoader
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Suratman_Usin
Posted On:   Saturday, June 2, 2001 12:40 PM

I tried the "Fundamental of Java Security" exercise#1 at http://developer.java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/ClassLoader/index.html. When I "moved" the tester.class to test subdirectory as instructed, the loading is succesful but I got IllegalAccessException because of newInstance(). After playing around, I just "copied" rather than "moved" the tester.java and everything works fine! I'm curious what is the problem with moving to the subdirectory creates that exception when trying to create a new instance of the class already successfully loaded?? Is my approach to just "copy" right? Thanks for whoever respond to this problem :) --Suratman    More>>

I tried the "Fundamental of Java Security" exercise#1 at http://developer.java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/ClassLoader/index.html.

When I "moved" the tester.class to test subdirectory as instructed, the loading is succesful but I got IllegalAccessException because of newInstance(). After playing around, I just "copied" rather than "moved" the tester.java and everything works fine! I'm curious what is the problem with moving to the subdirectory creates that exception when trying to create a new instance of the class already successfully loaded?? Is my approach to just "copy" right?

Thanks for whoever respond to this problem :)

--Suratman

   <<Less

Re: Basic Security: ClassLoader

Posted By:   Carlo_Rossi  
Posted On:   Monday, December 31, 2001 03:04 AM

I too found a mistake in first exercise "Your Class Loader": the method loadClassData is never entered on account that whatever class you want is loaded by findSystemClass.So you may write "java CLTester foo Tester"(instead of the correct " . Tester" ) and it works anyway.
It is not enough to remove the row "c=findSystemClass" because it is necessary for native classes.That row must be pasted (if c==null) before the row "c=defineClass".
Best regards.
Carlo Rossi
About | Sitemap | Contact