Results 1 to 3 of 3
- 12-06-2010, 12:47 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
java.system.class.loader Not Working
Alrightey, I needed a way to replace the bootstrap class loader (the main-est class loader) with my own for applets, and I found out that you can do this by adding the java.system.class.loader property to the Runtime Parameters text that is in the Java Control Panel. However, it doesn't seem to work and I'm kinda stumped as to why.

I set the Runtime Parameters text to:
And I also tried: -cp="C:\Documents and Settings\Yo\Desktop" (equals sign), but it made no difference.Java Code:-cp "C:\Documents and Settings\Yo\Desktop" -Djava.system.class.loader=CL2000
Here is my own class loader:
If it was working, the Java Console would contain the command to the user, but it doesn't because something's not right.Java Code:public class CL2000 extends ClassLoader { public CL2000() { commandUser(); } public CL2000(ClassLoader parent) { super(parent); commandUser(); } private void commandUser() { System.out.println("eat it"); } }
So what am I doing wrong?
- 12-06-2010, 06:25 PM #2
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
I doubt if you can write a bootstrap class loader, coz a bootstrap class loader is integral part of jvm. As bootstrap class loader is responsible for loading core java classes like java.lang.object, etc. You must provide the logic to load all these classes.
Moreover, it has to be written in native code.
- 12-06-2010, 09:41 PM #3
Member
- Join Date
- Dec 2010
- Posts
- 2
- Rep Power
- 0
Okay, it's probably not the bootstrap class loader but the one that loads the non-standard, user-created classes (i.e., not ones like Object, Point, Canvas, but the ones old man Jenkins wrote).
If I invoke a class that has a main method via the java command, everything seems to work fine.
So that yields this in the console:Java Code:java -Djava.system.class.loader=CL2000 SomeClass
Java Code:eat it //my class loader's message SomeClass executed!
I thought maybe changing the location of files might do the trick. So I set the Runtime Parameters text to (and of course moved CL2000):
Java Code:-cp="C:/" -Djava.system.class.loader=CL2000
I think it works because instead of an applet loading as usual and not having the class loader message in the Java Console, it just shows a black box for the applet... and no Java Console on top of that.
Now why's this happening?Last edited by kg1; 12-06-2010 at 09:45 PM. Reason: clarify
Similar Threads
-
Replace ClassLoader with custom class loader in Java Plugin
By pwlodarczak in forum Java AppletsReplies: 6Last Post: 09-20-2010, 07:46 AM -
class loader problems!
By alacn in forum New To JavaReplies: 6Last Post: 08-11-2010, 10:51 PM -
How Add new classess to the System Classs loader.
By echarish in forum Advanced JavaReplies: 0Last Post: 02-02-2010, 10:54 AM -
TCCL (Thread context class Loader) ???
By OutOfMemory in forum Advanced JavaReplies: 0Last Post: 01-07-2010, 12:38 PM -
Class loader
By JavaJunkie in forum New To JavaReplies: 1Last Post: 05-06-2009, 01:17 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks