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

scalac and classpath handling

2 replies
Mark Harrah
Joined: 2008-12-18,
User offline. Last seen 35 weeks 3 days ago.

I see that classpath handling is changing in trunk. My question is about how
to properly set up the classpath now. I need to invoke scalac:
* using only the location of scala-library.jar and scala-compiler.jar
* without scala.home set
* within an existing jvm, so the Scala jars are not in java.class.path

Currently, invocation looks something like:
val args = Array("-bootclasspath", bootCp, "-cp", usersClasspath)
scala.tools.nsc.Main.process(args)

where bootCp includes scala-library.jar and usersClasspath does not.

This worked fine until recent trunk, maybe two days ago or so. What is or will
be the recommended way going forward?

Thanks,
Mark

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: scalac and classpath handling

On Fri, Feb 12, 2010 at 03:04:20PM -0500, Mark Harrah wrote:
> * using only the location of scala-library.jar and scala-compiler.jar
> * without scala.home set
> * within an existing jvm, so the Scala jars are not in java.class.path

OK, I really need to explain what's going on in there and what the
motivations are, and I realize there is some bustedness at this second.
I promise these answers will be abundantly clear before too long, but I
have more than one fire burning. I will be glad to get your input as
it's just this sort of fine-grained classpath control that I'm trying to
make easy.

Mark Harrah
Joined: 2008-12-18,
User offline. Last seen 35 weeks 3 days ago.
Re: scalac and classpath handling

On Friday 12 February 2010 03:33:41 pm Paul Phillips wrote:
> On Fri, Feb 12, 2010 at 03:04:20PM -0500, Mark Harrah wrote:
> > * using only the location of scala-library.jar and scala-compiler.jar
> > * without scala.home set
> > * within an existing jvm, so the Scala jars are not in java.class.path
>
> OK, I really need to explain what's going on in there and what the
> motivations are, and I realize there is some bustedness at this second.
> I promise these answers will be abundantly clear before too long, but I
> have more than one fire burning. I will be glad to get your input as
> it's just this sort of fine-grained classpath control that I'm trying to
> make easy.

Yes, it is easy to see that it will be an improvement. I arrived at my
current approach partly by trial and error. I append scala-library.jar to
sun.boot.class.path to set -bootclasspath and clear scala.home. I will be
happy to have something more robust and intentional.

I could use a workaround if you will be a while, though, since it means that
sbt can't work with trunk.

Thanks,
Mark

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