This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SystemClassLoader and current directory


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]