3

IntelliJ IDEA 2017.1 has a built-in JShell, which imports all the project's libraries etc.

Is it possible to use this in Android Studio? (It is not in the Tools menu, as said in the blog post).


UPDATE: Android still does not support Java 8 completely, JShell is Java 9. It might still be possible to use the gradle jshell plugin, or use the Kotlin REPL.

serv-inc
  • 35,772
  • 9
  • 166
  • 188

1 Answers1

1

You can also use my project jshell-plugin that is a fork of the gradle jshell plugin you mentioned, but with improved features.

Also as you mentioned, you need JDK 9+ to run it, but if it is not your default JDK and you don't want to change that configuration from your local environment, here is a trick:

$ export JAVA_HOME="/path/to/jdk9+"
$ gradle --console plain jshell

The export of the JAVA_HOME environment variable will have effect only in the active console you have opened.

Mariano Ruiz
  • 4,314
  • 2
  • 38
  • 34