gpt4 book ai didi

scala - 在 IntelliJ 10.5 中配置 Scala 编译器?

转载 作者:行者123 更新时间:2023-12-04 17:03:55 31 4
gpt4 key购买 nike

我试图让 Scala 在 IntelliJ 10.5.1 中正常工作。我从“可用插件”设置安装了插件,然后尝试启动一个新的 Java 项目,在可用技术下选择“scala”。但是当我尝试运行它时,Scala 说我没有在 Scala 方面定义一个 Scala 编译器。所以我去了那里,但我没有看到任何设置编译器的方法。此外,我的项目中的 .iml 文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="scala" name="Scala">
<configuration>
<option name="compilerLibraryLevel" value="Global" />
<option name="pluginPaths">
<array>
<option value="$USER_HOME$/SDKs/scala/src/scala-compiler-src.jar" />
</array>
</option>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="scala " level="application" />
</component>
</module>

请注意,它似乎确实指向了正确的 jar 编译器目标。

我需要做什么?

编辑 -

编译器现在可以工作,但是当我运行时,出现此错误:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7540 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10 CE.app/bin -Dfile.encoding=UTF-8 -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home:/Users/me/Projects/Scala/testing/out/test/testing:/Users/me/Projects/Scala/testing/out/production/testing:/Users/me/SDKs/scala/lib/scala-library.jar:/Users/me/SDKs/scala/lib/scala-swing.jar:/Users/me/SDKs/scala/lib/scala-dbc.jar:/Applications/IntelliJ IDEA 10 CE.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain hello_world
Exception in thread "main" java.lang.ClassNotFoundException: hello_world
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)

Process finished with exit code 1

最佳答案

转到项目设置(可以通过 Ctrl+Alt+Shift+S 调用)并在库列表中选择 scala-compiler 就像这样:

enter image description here

现在 FacetManager组件看起来像这样:

<component name="FacetManager">
<facet type="scala" name="Scala">
<configuration>
<option name="compilerLibraryLevel" value="Global" />
<option name="compilerLibraryName" value="scala-compiler-2.9.0.1" />
</configuration>
</facet>
</component>

关于scala - 在 IntelliJ 10.5 中配置 Scala 编译器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7140937/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com