Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JShell console in Android Studio

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.

like image 378
serv-inc Avatar asked Jan 25 '26 23:01

serv-inc


1 Answers

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.

like image 141
Mariano Ruiz Avatar answered Jan 27 '26 18:01

Mariano Ruiz