0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Kotlinを始める上での注意点

0
Posted at

Kotlinを実行する際にJDKを__9-ea__にしていると、以下のようなエラーが表示されます。

Error:Kotlin: [Internal Error] java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessor
	at com.intellij.util.ReflectionUtil.getConstructorAccessor(ReflectionUtil.java:435)
	at com.intellij.util.text.StringFactory.<clinit>(StringFactory.java:33)
	at com.intellij.util.text.ByteArrayCharSequence.toString(ByteArrayCharSequence.java:58)
	at com.intellij.openapi.vfs.impl.jar.CoreJarHandler.getOrCreateFile(CoreJarHandler.java:55)
	at com.intellij.openapi.vfs.impl.jar.CoreJarHandler.<init>(CoreJarHandler.java:42)
	at com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem$1.create(CoreJarFileSystem.java:37)
	at com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem$1.create(CoreJarFileSystem.java:33)
	at com.intellij.util.containers.FactoryMap.get(FactoryMap.java:56)
	at com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem.findFileByPath(CoreJarFileSystem.java:50)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.findJarRoot(KotlinCoreEnvironment.kt:249)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.contentRootToVirtualFile(KotlinCoreEnvironment.kt:228)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.addJavaRoot(KotlinCoreEnvironment.kt:202)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.fillClasspath(KotlinCoreEnvironment.kt:197)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:126)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:98)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:301)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:228)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:179)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
	at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:199)
	at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:154)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execAndOutputXml(CLICompiler.java:73)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$remoteIncrementalCompile$1.invoke(CompileServiceImpl.kt:247)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$remoteIncrementalCompile$1.invoke(CompileServiceImpl.kt:70)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$1$1.invoke(CompileServiceImpl.kt:421)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$1$1.invoke(CompileServiceImpl.kt:70)
	at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:454)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$checkedCompile(CompileServiceImpl.kt:70)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$1.invoke(CompileServiceImpl.kt:420)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$1.invoke(CompileServiceImpl.kt:70)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive(CompileServiceImpl.kt:565)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive$default(CompileServiceImpl.kt:504)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:411)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.remoteIncrementalCompile(CompileServiceImpl.kt:244)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:535)
	at sun.rmi.server.UnicastServerRef.dispatch(java.rmi@9-ea/UnicastServerRef.java:321)
	at sun.rmi.transport.Transport$1.run(java.rmi@9-ea/Transport.java:200)
	at sun.rmi.transport.Transport$1.run(java.rmi@9-ea/Transport.java:197)
	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
	at sun.rmi.transport.Transport.serviceCall(java.rmi@9-ea/Transport.java:196)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(java.rmi@9-ea/TCPTransport.java:562)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(java.rmi@9-ea/TCPTransport.java:795)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(java.rmi@9-ea/TCPTransport.java:677)
	at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(java.rmi@9-ea/TCPTransport.java:676)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@9-ea/ThreadPoolExecutor.java:1158)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@9-ea/ThreadPoolExecutor.java:632)
	at java.lang.Thread.run(java.base@9-ea/Thread.java:843)
Caused by: java.lang.ClassNotFoundException: sun.reflect.ConstructorAccessor
	at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-ea/BuiltinClassLoader.java:366)
	at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-ea/ClassLoaders.java:185)
	at java.lang.ClassLoader.loadClass(java.base@9-ea/ClassLoader.java:419)
	... 52 more

Kotlinを実行する際には、__1.8__あたりを使うのが妥当でしょう。

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?