Java The Solution

Jamal Desir
Jamal Desir
1,184 Points

bash: command not found?

For some reason, it gives me the message "bash: command not found" when I run the code. Did i do something wrong? Here's my code:


public class Greeter {

public static void main(String[] args) { Console console = System.console();

String place = "Walmart";
String firstName = console.readLine("What is your first name:  ");
console.printf("Hello %s! Welcome to %s. %n" , firstName , place);



You did run command correctly? after you saved your file. I mean: javac <name>.java && java <name>

Codrin Postu
Codrin Postu
8,020 Points

You most probably wrote in bash "" which is incorrect.

To run the program you need to first compile it using "javac" and then run it with "java Greeter"