使用 Java REPL


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

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

  • Support for most of Java language constructs

  • Access from console as well as web terminal via browser

  • Create imports, methods, classes, enums and interfaces

  • Load classes from any jar file or directory (including web urls)

  • Load and evaluate expression from file

  • List previous results, imports, created types and methods

  • Show history of evaluations

  • Search and evaluate expression from history

  • Clear and replay previous evaluations

  • Load and evaluate any Java source file

  • Basic code completion for results, classes and methods

  • Coloured output for console and web terminal

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

. 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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,448评论 0 10
  • 认知差异,是人和人最大的差异 作家史铁生曾说:人和人的区别,大于人和猪的差别。 人和猪的区别,只是思想和不思想的区...
    大道行者_阅读 5,243评论 1 4
  • 2018年4月3日 星期二 记不清第几次来济南了,但永远无法忘记第一次的经历。离别之际,表以留忆。 01.温暖同学...
    一言一诺阅读 465评论 6 5
  • 所有人都告诉你,你可以的,但惟独你告诉自己,我不可以,我做不到。 这到底是一种什么样的自卑感! 这段时间发生的事情...
    祎然momo阅读 141评论 0 0
  • 一直以来评分特别高的这部电影,今天终于看了,不得不说,它感动了我,不得不说这部电影是为数不多的我看完了还想继续贡献...
    今天安好阅读 155评论 0 0