Java Terminal Issues

Hi! This is my very first coding encounter as I am coming from a non-tech background, and my Qs are very basic. I appreciate if anyone could help me. Thanks!

When I am trying to execute my first Java project in IntelliJ Terminal; I am facing two issues:

I am not seeing the name of the project as my main source and I am seeing:

Microsoft Windows [Version 10.0.19044.1706]
(c) Microsoft Corporation. All rights reserved.

C:\Users\yasame\IdeaProjects\Hello World\Hello World\src\com>

I am also receiving an error message in red or the following message, when I type $javac Main.java :

‘$javac’ is not recognized as an internal or external command,
operable program or batch file.

  1. Not sure about that one, but it seems Windows specific and I do not have a Windows computer handy.

  2. This looks like you typed $javac instead of javac - you will sometimes see people write commands that are meant to be written at the command prompt like this:

    $ javac ...
    

    But the $ character at the start of the line is just a character to represent the prompt (where you type your input). If you still get an error when you use javac instead of $javac please make sure that you have Java installed on your machine and that the path to its install location is in the PATH variable.

1 Like

Hi, i think im facing with similar the same issue, this is the output i get
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell Install PowerShell on Windows, Linux, and macOS - PowerShell | Microsoft Docs

PS C:\Users\jason\IdeaProjects\HelloWorld\src\com\codewithmosh>

Really appreciates it if someone can help. Thanks!!

A terminal is just a tool for being able to run commands. It looks like you have opened the terminal but not issues any commands. What exactly were you trying to do? Did you want to run the Java code you have in the UI? If so, I think VSCode has extensions which can make that easier. You could try clicking on the green arrow next to your main method and see what that does for you. I suspect that triggers an extension which will run the main method in your class there.

1 Like