Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command window for java?

Tags:

java

matlab

Is there a way to just run individual java commands without having to create a file? Kind of like the matlab command window, where you can just type one line and it'll run.

like image 708
qwert Avatar asked Oct 14 '16 16:10

qwert


2 Answers

Currently No. Java is not a terminal programming language like matlab and python.

To run java applications, the commands must be compiled

When you compile, the java compiler turns the code into a class file. The class file contains "instructions" for the computer which is the application.

To clarify, Java 9 has JShell, which is a REPL for java. You can find the early access here.

like image 66
ItamarG3 Avatar answered Oct 25 '22 18:10

ItamarG3


I think what you are looking for is something like this

https://blogs.oracle.com/java/jshell-and-repl-in-java-9

Sadly it isn't available until java 9, so in its current state it might not be production ready

try is here https://jdk9.java.net/download/

this shows you how to get it going

http://www.journaldev.com/9879/java9-install-and-repl-jshell-tutorial

like image 29
Ash Avatar answered Oct 25 '22 18:10

Ash