Open
Description
Minimized code
$ scalac -classpath work.jar -d work.jar scala3test.sc
contents of file tmp/scala3test.sc:
object S3test {
def main(args:Array[String]):Unit =
println("Yo!")
}
There doesn't appear to be any problems in Linux, only Windows 10.
This complicates scripting support for very long classpaths, which effectively requires use of an @argsfile (wildcard classpath entries don't work in Windows currently). It leads to creation of two classpath args files, one for the compile phase and one for the runtime.
Output (click arrow to expand)
exception occurred while compiling scala3test.sc java.nio.file.FileSystemException: C:\Users\philwalk\workspace\optue\work.jar: The process cannot access the file because it is being used by another process. while compiling scala3test.sc Exception in thread "main" java.nio.file.FileSystemException: C:\Users\philwalk\workspace\optue\work.jar: The process cannot access the file because it is being used by another process. at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274) at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105) at java.base/java.nio.file.Files.delete(Files.java:1141) at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.sync(ZipFileSystem.java:1357) at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.lambda$close$2(ZipFileSystem.java:269) at java.base/java.security.AccessController.doPrivileged(Native Method) at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.close(ZipFileSystem.java:268) at dotty.tools.io.JarArchive.close(JarArchive.scala:12) at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:71) at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:185) at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15) at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10) at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323) at dotty.tools.dotc.Run.runPhases$5(Run.scala:195) at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:203) at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67) at dotty.tools.dotc.Run.compileUnits(Run.scala:210) at dotty.tools.dotc.Run.compileSources(Run.scala:147) at dotty.tools.dotc.Run.compile(Run.scala:129) at dotty.tools.dotc.Driver.doCompile(Driver.scala:38) at dotty.tools.dotc.Driver.process(Driver.scala:193) at dotty.tools.dotc.Driver.process(Driver.scala:162) at dotty.tools.dotc.Driver.process(Driver.scala:174) at dotty.tools.dotc.Driver.main(Driver.scala:201) at dotty.tools.dotc.Main.main(Main.scala)