SystemClassLoader and current directory

Andrew Haley aph@redhat.com
Thu Feb 9 15:00:00 GMT 2006


Thomas Hallgren writes:
 > Hi,
 > I seems the SystemClassLoader is setup to search the current
 > directory by default. Is there anything I can do to prevent this? I
 > use GCJ embedded with the PostgreSQL backend and the VM is
 > initialized using JNI.
 > 
 > I provide a ClassLoader that will utilize the database and it's
 > essential that the Java code is prevented from using the file
 > system.
The standard trick here is to set your ClassLoader's parent to null
and use it to load your startup main class. All references from
classes referred to my main will use only your ClassLoader.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /