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 GitHub Docker PullsJava 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
Maven 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
网友评论