I have a very simple java code - I'm just learning Java.
However I don't want to have to retype javac file.java
and java file
again and again for a little change.
Is there a way to do it faster? Or a one-liner that I can quickly copy & paste?
I have a very simple java code - I'm just learning Java.
However I don't want to have to retype javac file.java
and java file
again and again for a little change.
Is there a way to do it faster? Or a one-liner that I can quickly copy & paste?
You can use an IDE, such as Eclipse or NetBeans, to directly run without typing anything. This is because the IDE automatically recompiles changed code for you.
Download link for Eclipse: https://www.eclipse.org/downloads/packages/release/kepler/sr1/eclipse-ide-java-developers
You can run both commands as a one-liner, using &&
so that the second command will only run if the first was successful:
javac file.java && java file
Then you can just press up in the terminal window to access the command without having to retype it.