Monday, November 15, 2021

[SOLVED] Run java with terminal

Issue

Is it possible to run in terminal java program that contains multiple files? When I'm using

javac main.java

terminal can't find any files except main.java


Solution

First you compile your .java files

javac *.java

then you run it by typing,

java main

where main is the class with your main method, in the terminal.



Answered By - mattias