Reputation: 331
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.
Upvotes: 8
Views: 171
Reputation: 4122
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.
Upvotes: 5
Reputation: 2602
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
Upvotes: 4