Skip to content

System.property "scala.home" is not being set when launching scripts #13758

Closed
@philwalk

Description

@philwalk

Compiler version

Scala code runner version 3.1.1-RC1-bin-SNAPSHOT-git-3e192a3 -- Copyright 2002-2021, LAMP/EPFL

Minimized code

The following script attempts to print out the runtime scala install directory.

#!/usr/bin/env scala3
def main(args: Arra[String]): Unit =
   println(sys.props("scala.home"))

Output

null

Expectation

should print the path to the runtime scala.

Note that there is no simple alternative to figuring out the path to the current runtime scala.
Different scripts can specify different versions of scala via the hashbang line, so environment variables can't be relied on.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions