前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用 Java REPLJava REPL

使用 Java REPLJava REPL

作者头像
一个会写诗的程序员
发布2018-08-17 15:09:08
4850
发布2018-08-17 15:09:08
举报
文章被收录于专栏:一个会写诗的程序员的博客
代码语言:javascript
复制
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

Travis
Travis

Travis

GitHub
GitHub

GitHub

Docker Pulls
Docker Pulls

Docker Pulls

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:

代码语言:javascript
复制
$ 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

代码语言:javascript
复制
$ java -jar build/libs/javarepl-dev.jar

Releases

Releases are automatically released to

Maven Central
Maven Central

Maven Central

. Configure repository and then add Java REPL as dependency:

代码语言:javascript
复制
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:

代码语言:javascript
复制
$ java -jar javarepl-SOME_VERSION.jar

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

代码语言:javascript
复制
$ /bin/java -jar javarepl-SOME_VERSION.jar

License

Distributed under the Apache 2.0

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2017.08.01 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Java REPL
    • Build
      • Releases
        • Usage
          • License
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档