This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Compiling with Custom ClassLoader

1 reply
Ryan Richt
Joined: 2011-05-02,
User offline. Last seen 42 years 45 weeks ago.

Dear Debate,

I dont think most people will be interested, so posting to debate.

I would like to compile my class code while having it 'link' against classes that are not on disk/classpath but are accessible only from a custom (network/DB) ClassLoader.

You can do this with Java using:

javac -J-Djava.system.class.loader=

So I'm wondering if this works as expected using:

scalac -Djava.system.class.loader

including 'linking' scala code against scala code in the custom DB ClassLoader?

Any lurking surprises I might later encounter? I'll post back for posterity with some of my own tests soon.

Thank you,

Ryan Richt
Genome Integration Lead
Monsanto
This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled
to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and
all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.

All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its
subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware".
Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying
this e-mail or any attachment.

The information contained in this email may be subject to the export control laws and regulations of the United States, potentially
including but not limited to the Export Administration Regulations (EAR) and sanctions regulations issued by the U.S. Department of
Treasury, Office of Foreign Asset Controls (OFAC). As a recipient of this information you are obligated to comply with all
applicable U.S. export laws and regulations.

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Compiling with Custom ClassLoader

On 5/2/11 11:50 AM, Ryan Richt wrote:
> So I'm wondering if this works as expected using:
>
> scalac -Djava.system.class.loader
>
> including 'linking' scala code against scala code in the custom DB ClassLoader?
>
> Any lurking surprises I might later encounter? I'll post back for posterity with some of my own tests soon.

I don't think there's any way scala could even notice. (Short of
checking whether the "java.system.class.loader" property is set, which
it doesn't do.) If it acts like the system classloader, then it will act
like the system classloader.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland