New IntelliJ Bug

Answered

I try to compile a simple object in IntelliJ:

object Test02 {
def main(args: Array[String]) { println("Hello World"); }}

I got this message:

Error:scalac: Scala compiler JARs not found (module 'scala02'):
E:\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.11.8.jar,
E:\.ivy2\cache\org.scala-lang\scala-compiler\jars\scala-compiler-2.11.8.jar,
E:\.ivy2\cache\org.scala-lang\scala-reflect\jars\scala-reflect-2.11.8.jar

I checked the Project Structure and checked the modules.
Modules are located here:

C:/Users/asus1/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.11.8.jar


How Can I change E: to C:/Users/asus1/ ?
Do I need to move all to E: ?

How people manage when the project and the jar are in different location ?

It seems a bug of IntellJ ...?

 

 

23 comments

How did you create this project? Is it imported from SBT? Does it build from the command line outside of IDEA?

If you create a new plain Scala project, there is an option to specify where Scala SDK is located:

Click Create button and either select the valid SDK from Ivy/Maven or specify the local path on the system.

0

I created the project from scratch.

How can I modify it after the project has been created ? It seems that I can only modify the 

   real location  ---> Location specify by the project.

    C:   --> E:

 

Thanks

0

You will need to change the library jars here:

0

I can change physically the path of the JAR and put into E:\.ivy2\cache\

But, How can I specify the project compiler to use the right folder ?

   it uses E instead of C:  (think this is IntelliJ bug....)

 

0) In community Edition, where can I find the 

1)

Error:scalac: Scala compiler JARs not found (module 'scala02'): E:\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.11.8.jar, E:\.ivy2\cache\org.scala-lang\scala-compiler\jars\scala-compiler-2.11.8.jar, E:\.ivy2\cache\org.scala-lang\scala-reflect\jars\scala-reflect-2.11.8.jar

 

2)

 

 

3) 

 

 

0

Please zip and share the complete project folder.

0

I can't reproduce the problem. IDE is using the classes from the SDK library when compiling. Please enable debug logging for build.log and attach it after reproducing the problem: https://intellij-support.jetbrains.com/hc/articles/207241085.

0

Using Community 2016.1 :, I have this one:

 

BUILD LOG

2016-04-04 03:03:56,453 [ 396973] INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:false
2016-04-04 03:03:56,453 [ 396973] INFO - kotlin.jps.build.KotlinBuilder - is Kotlin incremental compilation enabled: true
2016-04-04 03:03:56,453 [ 396973] INFO - kotlin.jps.build.KotlinBuilder - is Kotlin experimental incremental compilation enabled: false
2016-04-04 03:03:56,503 [ 397023] INFO - kotlin.jps.build.KotlinBuilder - is Kotlin compiler daemon enabled: true
2016-04-04 03:03:56,503 [ 397023] INFO - kotlin.jps.build.KotlinBuilder - Label in local history: build started fc342a74
2016-04-04 03:03:56,579 [ 397099] INFO - r.api.ClassFilesIndicesBuilder - class files data index disabled
2016-04-04 03:03:57,539 [ 0] INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: E:/_devs/IntelliJ_IDEA_2016/lib/jps-launcher.jar;E:/_devs/JDK7/lib/tools.jar;E:/_devs/IntelliJ_IDEA_2016/lib/optimizedFileManager.jar;E:/_devs/IntelliJ_IDEA_2016/lib/ecj-4.5.2.jar
2016-04-04 03:03:57,569 [ 30] DEBUG - .logging.InternalLoggerFactory - Using Log4J as the default logging framework
2016-04-04 03:03:57,573 [ 34] DEBUG - nnel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
2016-04-04 03:03:57,607 [ 68] DEBUG - il.internal.PlatformDependent0 - java.nio.Buffer.address: available
2016-04-04 03:03:57,607 [ 68] DEBUG - il.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
2016-04-04 03:03:57,607 [ 68] DEBUG - il.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
2016-04-04 03:03:57,608 [ 69] DEBUG - il.internal.PlatformDependent0 - java.nio.Bits.unaligned: true
2016-04-04 03:03:57,608 [ 69] DEBUG - til.internal.PlatformDependent - Platform: Windows
2016-04-04 03:03:57,608 [ 69] DEBUG - til.internal.PlatformDependent - Java version: 7
2016-04-04 03:03:57,609 [ 70] DEBUG - til.internal.PlatformDependent - -Dio.netty.noUnsafe: false
2016-04-04 03:03:57,609 [ 70] DEBUG - til.internal.PlatformDependent - sun.misc.Unsafe: available
2016-04-04 03:03:57,609 [ 70] DEBUG - til.internal.PlatformDependent - -Dio.netty.noJavassist: false
2016-04-04 03:03:57,610 [ 71] DEBUG - til.internal.PlatformDependent - Javassist: unavailable
2016-04-04 03:03:57,610 [ 71] DEBUG - til.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes. Please check the configuration for better performance.
2016-04-04 03:03:57,610 [ 71] DEBUG - til.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\asus1\.IdeaIC2016\system\compile-server\_temp_ (java.io.tmpdir)
2016-04-04 03:03:57,610 [ 71] DEBUG - til.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
2016-04-04 03:03:57,610 [ 71] DEBUG - til.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
2016-04-04 03:03:57,611 [ 72] DEBUG - netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
2016-04-04 03:03:57,611 [ 72] DEBUG - netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
2016-04-04 03:03:57,648 [ 109] DEBUG - netty.channel.DefaultChannelId - -Dio.netty.processId: 1923 (user-set)
2016-04-04 03:03:57,648 [ 109] DEBUG - netty.channel.DefaultChannelId - -Dio.netty.machineId: 9e43d860 (user-set)
2016-04-04 03:03:57,649 [ 110] DEBUG - til.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0x38c94d8dc93c278c
2016-04-04 03:03:57,658 [ 119] DEBUG - etty.util.ResourceLeakDetector - -Dio.netty.leakDetection.level: simple
2016-04-04 03:03:57,658 [ 119] DEBUG - etty.util.ResourceLeakDetector - -Dio.netty.leakDetection.maxRecords: 4
2016-04-04 03:03:57,675 [ 136] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.numHeapArenas: 6
2016-04-04 03:03:57,675 [ 136] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.numDirectArenas: 6
2016-04-04 03:03:57,675 [ 136] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.pageSize: 8192
2016-04-04 03:03:57,675 [ 136] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxOrder: 11
2016-04-04 03:03:57,676 [ 137] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.chunkSize: 16777216
2016-04-04 03:03:57,676 [ 137] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.tinyCacheSize: 512
2016-04-04 03:03:57,676 [ 137] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.smallCacheSize: 256
2016-04-04 03:03:57,676 [ 137] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.normalCacheSize: 64
2016-04-04 03:03:57,676 [ 137] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.maxCachedBufferCapacity: 32768
2016-04-04 03:03:57,676 [ 137] DEBUG - .buffer.PooledByteBufAllocator - -Dio.netty.allocator.cacheTrimInterval: 8192
2016-04-04 03:03:57,687 [ 148] DEBUG - io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
2016-04-04 03:03:57,687 [ 148] DEBUG - io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536
2016-04-04 03:03:57,687 [ 148] DEBUG - io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
2016-04-04 03:03:57,749 [ 210] INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 188 ms
2016-04-04 03:03:57,757 [ 218] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2016-04-04 03:03:57,777 [ 238] INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = D:/_devs/Scala/scala02, global options path = C:/Users/asus1/.IdeaIC2016/config/options
2016-04-04 03:03:57,843 [ 304] DEBUG - #org.jetbrains.jps.TimingLog - loading: path.macros.xml:PathMacrosImpl in 44ms
2016-04-04 03:03:57,847 [ 308] DEBUG - .serialization.JpsGlobalLoader - Loading config from C:\Users\asus1\.IdeaIC2016\config\options
2016-04-04 03:03:57,933 [ 394] DEBUG - #org.jetbrains.jps.TimingLog - loading: applicationLibraries.xml:libraryTable in 86ms
2016-04-04 03:03:57,938 [ 399] DEBUG - .library.JpsSdkTableSerializer - Loading JavaSDK SDK '1.7 (1)'
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - 1.7 (1) SDK classpath (19 roots):
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\charsets.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\deploy.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\access-bridge-64.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\dnsns.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\jaccess.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\localedata.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\sunec.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\sunjce_provider.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\sunmscapi.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\ext\zipfs.jar
2016-04-04 03:03:57,945 [ 406] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\javaws.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\jce.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\jfr.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\jfxrt.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\jsse.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\management-agent.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\plugin.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\resources.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - .library.JpsSdkTableSerializer - E:\_devs\JDK7\jre\lib\rt.jar
2016-04-04 03:03:57,946 [ 407] DEBUG - #org.jetbrains.jps.TimingLog - loading: jdk.table.xml:ProjectJdkTable in 13ms
2016-04-04 03:03:57,947 [ 408] DEBUG - #org.jetbrains.jps.TimingLog - loading: filetypes.xml:CommunityFileTypes in 1ms
2016-04-04 03:03:57,949 [ 410] DEBUG - #org.jetbrains.jps.TimingLog - loading: encoding.xml:Encoding in 2ms
2016-04-04 03:03:57,954 [ 415] DEBUG - #org.jetbrains.jps.TimingLog - loading: other.xml:GlobalAntConfiguration in 4ms
2016-04-04 03:03:57,959 [ 420] DEBUG - #org.jetbrains.jps.TimingLog - loading: IntelliLang.xml:LanguageInjectionConfiguration in 4ms
2016-04-04 03:03:57,962 [ 423] DEBUG - #org.jetbrains.jps.TimingLog - loading: scala.xml:ScalaSettings in 3ms
2016-04-04 03:03:57,976 [ 437] DEBUG - #org.jetbrains.jps.TimingLog - loading: misc.xml:ProjectRootManager in 6ms
2016-04-04 03:03:57,981 [ 442] DEBUG - #org.jetbrains.jps.TimingLog - loading: compiler.xml:CompilerConfiguration in 5ms
2016-04-04 03:03:58,019 [ 480] DEBUG - #org.jetbrains.jps.TimingLog - loading: workspace.xml:CompilerWorkspaceConfiguration in 38ms
2016-04-04 03:03:58,021 [ 482] DEBUG - #org.jetbrains.jps.TimingLog - loading: compiler.xml:JavacSettings in 2ms
2016-04-04 03:03:58,022 [ 483] DEBUG - #org.jetbrains.jps.TimingLog - loading: compiler.xml:EclipseCompilerSettings in 1ms
2016-04-04 03:03:58,023 [ 484] DEBUG - #org.jetbrains.jps.TimingLog - loading: compiler.xml:RmicSettings in 1ms
2016-04-04 03:03:58,024 [ 485] DEBUG - #org.jetbrains.jps.TimingLog - loading: encodings.xml:Encoding in 0ms
2016-04-04 03:03:58,025 [ 486] DEBUG - #org.jetbrains.jps.TimingLog - loading: compiler.xml:ErrorProneCompilerSettings in 1ms
2016-04-04 03:03:58,026 [ 487] DEBUG - #org.jetbrains.jps.TimingLog - loading: ant.xml:AntConfiguration in 0ms
2016-04-04 03:03:58,061 [ 522] DEBUG - #org.jetbrains.jps.TimingLog - loading: workspace.xml:antWorkspaceConfiguration in 35ms
2016-04-04 03:03:58,065 [ 526] DEBUG - #org.jetbrains.jps.TimingLog - loading: uiDesigner.xml:uidesigner-configuration in 2ms
2016-04-04 03:03:58,065 [ 526] DEBUG - #org.jetbrains.jps.TimingLog - loading: groovyc.xml:GroovyCompilerProjectConfiguration in 0ms
2016-04-04 03:03:58,067 [ 528] DEBUG - #org.jetbrains.jps.TimingLog - loading: compiler.xml:GreclipseSettings in 2ms
2016-04-04 03:03:58,068 [ 529] DEBUG - #org.jetbrains.jps.TimingLog - loading: androidDexCompiler.xml:AndroidDexCompilerConfiguration in 0ms
2016-04-04 03:03:58,069 [ 530] DEBUG - #org.jetbrains.jps.TimingLog - loading: scala_compiler.xml:ScalaCompilerConfiguration in 0ms
2016-04-04 03:03:58,071 [ 532] DEBUG - #org.jetbrains.jps.TimingLog - loading: kotlinc.xml:KotlinCommonCompilerArguments in 0ms
2016-04-04 03:03:58,071 [ 532] DEBUG - #org.jetbrains.jps.TimingLog - loading: kotlinc.xml:Kotlin2JvmCompilerArguments in 0ms
2016-04-04 03:03:58,071 [ 532] DEBUG - #org.jetbrains.jps.TimingLog - loading: kotlinc.xml:Kotlin2JsCompilerArguments in 0ms
2016-04-04 03:03:58,071 [ 532] DEBUG - #org.jetbrains.jps.TimingLog - loading: kotlinc.xml:KotlinCompilerSettings in 0ms
2016-04-04 03:03:58,093 [ 554] DEBUG - #org.jetbrains.jps.TimingLog - loading modules in 21ms
2016-04-04 03:03:58,094 [ 555] DEBUG - #org.jetbrains.jps.TimingLog - loading project libraries in 1ms
2016-04-04 03:03:58,094 [ 555] DEBUG - #org.jetbrains.jps.TimingLog - loading artifacts in 0ms
2016-04-04 03:03:58,094 [ 555] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 317 ms
2016-04-04 03:03:58,094 [ 555] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 1 modules, 0 libraries
2016-04-04 03:03:58,165 [ 626] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=500; buffer=10; max=602
2016-04-04 03:03:58,290 [ 751] INFO - etbrains.jps.cmdline.BuildMain - Pre-loaded process ready in 751 ms
2016-04-04 03:03:58,298 [ 759] DEBUG - io.netty.util.Recycler - -Dio.netty.recycler.maxCapacity.maxCapacity: 262144
2016-04-04 03:03:58,319 [ 780] DEBUG - o.netty.buffer.AbstractByteBuf - -Dio.netty.buffer.bytebuf.checkAccessible: true

0

Not idea.log, build.log with debug info. Please zip and share it.

0

yes, I have updated it.

 

Community Edition 2016.1:

Config:   https://goo.gl/0AMZKk

Option XML files: https://goo.gl/mCNKUS

To summarize:

JDK:   E:\_devs\JDK7\

Source Project:  D:/_devs/Scala/scala02/

Scala Project: C:/Users/asus1/.ivy2/cache/org.scala-lang/

Classpath: E:/_devs/IntelliJ_IDEA_2016/lib/jps-launcher.jar;E:/_devs/JDK7/lib/tools.jar;E:/_devs/IntelliJ_IDEA_2016/lib/optimizedFileManager.jar;E:/_devs/IntelliJ_IDEA_2016/lib/ecj-4.5.2.jar

global options path = C:/Users/asus1/.IdeaIC2016/config/options

 

 

 

 

0

Hi,
I couldn't reproduce such behaviour too, but I found a probable cause. Paths to Scala Sdk are stored relative to USER_HOME directory (see options/applicationLibraries.xml). It seems that System.getProperty("user.home") returns wrong value when called in the compiler process. I'm not sure why it happens, maybe it is related to this bug.

You can pass the correct value of "user.home" property for the compiler process, as shown in screenshot.





0

Switching to Java 8 may also help as it fixes the problem with resolving user.home that existed in 1.7.

0

This bug still seems to exist with latest intellij, java 8 and scala 2.11:

 

Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK SBT: org.scala-lang:scala-library:2.11.8:jar

 

has anyone found a fix?

0

Unfortunately that does not seem to be the issue. 

 

https://stackoverflow.com/questions/24019834/error-scala-no-scala-library-jar-in-scala-compiler-library

 

This is closer but no suggestions here worked for me.

0

How do you create your project? Also, please attach a screenshot of your scala-sdk, like this:


0

I have the same issue.

I created a new project using the standard new Scala->SBT path with 2.11.11. I notice that my Scala-SDK is not the same as yours.

 

 

 

IntelliJ IDEA 2017.2.1
Build #IU-172.3544.35, built on July 31, 2017
Licensed to Zulily

JRE: 1.8.0_152-release-915-b6 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

 

0

Adding the jars to the classpath manually and then restarting worked.. 

0

I am running into this myself anytime I touch build.sbt and Refresh the project I have to remove the Scala sdk it imports and import the SDK manually.

 

IntelliJ IDEA 2017.2.5
Build #IU-172.4343.14, built on September 25, 2017
JRE: 1.8.0_152-release-915-b12 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.13

 

build.sbt

name := "FlurryFetch"

version := "0.1"

scalaVersion := "2.11.8"

libraryDependencies += "org.scalaj" %% "scalaj-http" % "2.3.0"

libraryDependencies += "net.liftweb" %% "lift-json" % "3.1.1"
2

I'm having exactly the same issue. Workaround suggested by David does work (thanks a lot mate!), maybe this will shed some light on where this is coming from.

0

If you are using sbt 1.0.2, this problem might be due to a bug in sbt. A fix is expected for sbt 1.0.3.

Related issues: 

possible workarounds:

  • configure scala version 2.12.3
  • OR downgrade to sbt 0.13.16
0

Justin,

That helps! Thanks! I downgraded to 0.13.16, since I need 2.11.8 for Spark development and I don't need anything fancy from sbt.

 

--

David

0

Please sign in to leave a comment.