Sublime configures Scala compilation and execution

  • First, the computer needs to install scala and configure the environment variables.
    At the beginning, according to the online configuration, directly use the scala command to execute the scala script with the path and report an error
    scal executes the script with the path and reports an error
Exception in thread "main" java.lang.IllegalArgumentException: name
        at java.base/jdk.internal.loader.URLClassPath$Loader.getResource(URLClassPath.java:636)
        at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:314)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:455)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at scala.reflect.internal.util.ScalaClassLoader.$anonfun$tryClass$1(ScalaClassLoader.scala:51)
        at scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:245)
        at scala.util.control.Exception$Catch.apply(Exception.scala:227)

  • If you enter the script directory first, and then call it with scala, it can be executed normally
    normal execution
  • Configure sublime (Tools -> Build System -> New Build System), save as Scala.sublime-build
    insert image description here
    insert image description here
    configure Scala.sublime-build
{
    
    
	"shell_cmd": "cd ${file_path} & scala \"$file_name\"",
	"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
	"selector": "source.scala",
	"encoding": "gbk"
}

Supongo que te gusta

Origin blog.csdn.net/u012132482/article/details/110518277
Recomendado
Clasificación