Java 8 · Java 9 · Java X · Java 实践指北

使用 Java REPL

2017-08-01  本文已影响36人  光剑书架上的书

chapter1_basics$ java -jar javarepl-428.jar

Welcome to JavaREPL version 428 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40)

Type expression to evaluate, :help for more options or press tab to auto-complete.

Connected to local instance at http://localhost:49659

java> System.out.println("Hello,World")

Hello,World

java> System.out.println("Hello,World"+new Date())

Hello,WorldTue Aug 01 10:08:21 CST 2017

java> System.out.println("Hello,World! "+new Date())

Hello,World! Tue Aug 01 10:08:29 CST 2017

java> 1+1

java.lang.Integer res0 = 2

java>


下载地址:

https://github.com/albertlatacz/java-repl/releases

Java REPL

TravisTravis

GitHubGitHub

Docker PullsDocker Pulls

Java REPL is a simple Read-Eval-Print-Loop for Java language.

Web version is available at www.javarepl.com.

Build

Building Java REPL requires the gradle.

After cloning the git repository, navigate over to it and run:


$ gradle shadowJar

After this completes, the jar completed with bundled dependencies will be located at build/libs/javarepl-dev.jar

Type the following to run


$ java -jar build/libs/javarepl-dev.jar

Releases

Releases are automatically released to

Maven CentralMaven Central. Configure repository and then add Java REPL as dependency:



com.javarepl

javarepl

SOME_VERSION

Usage

To run Java REPL you need to install Java Development Kit (JDK). Download it from here and follow install instructions. Once JDK is installed and configured, download latest Java REPL release from GitHub or Bintray then run:


$ java -jar javarepl-SOME_VERSION.jar

If this doesn't work try to run pointing directly to java executable within JDK, like so


$ /bin/java -jar javarepl-SOME_VERSION.jar

License

Distributed under the Apache 2.0

上一篇 下一篇

猜你喜欢

热点阅读