For some reason, I wanted to compile and execute the minimum code of Hello World at the command prompt, so this is an article to keep as a memorandum.
class hello{
public static void main(String[] args){
System.out.println("Hello World");
}
}
Use Win key </ kbd> + R </ kbd> </ kbd> to display the `[Run]`
dialog, and cmd Execute </ kbd>.
At the prompt, check if the paths of java.exe
and
javac.exe``` are in place, and then check the version
> java -version
> javac -version
If you see an error like the one below, check the environment variables because the path is not in your path.
Use Win key </ kbd> + Pause </ kbd> </ kbd> to display Control Panel \ System and Security \ System </ kbd> and `[System] Advanced settings] From
`.
'javac'Is an internal or external command,
It is not recognized as an operable program or batch file.
Or rather, it's an error because it doesn't pass, so if it should be somewhere, look for it directly under the C drive.
> c:
> cd \
> dir javac.exe /s
This is not a very preferable method, so if you find one, use Ctrl </ kbd> + Esc </ kbd> </ kbd> to forcibly terminate the process. Create a shortcut for ``` javac.exe`` in the found folder, place it in any folder, and execute it.
> javac.lnk {Full path to any java source file}
--``` [Run] `` `Display the dialog: Win key </ kbd> + R </ kbd> </ kbd> -Show Control Panel \ System and Security \ System </ kbd>: Win key </ kbd> + Pause </ kbd> </ kbd> --Command prompt exe name: cmd </ kbd> --Maximize window at command prompt (portrait): Alt </ kbd> + Space </ kbd> </ kbd>, X </ kbd> </ kbd>, or Win key </ kbd> </ kbd>, ← </ kbd> </ kbd> or ↑ </ kbd> </ kbd> or → </ kbd> </ kbd> --Folder name input completion at command prompt: Tab </ kbd> </ kbd> (Next candidate is displayed each time you press) --Copy a specific range of strings at the command prompt: Alt </ kbd> + Space </ kbd> </ kbd>, E </ kbd> < / kbd>, Enter </ kbd> </ kbd>, Range selection (key operation or drag with mouse), Enter </ kbd> </ kbd> --Paste the clipboard string at the command prompt: Alt </ kbd> + Space </ kbd> </ kbd>, E </ kbd> </ kbd >, P </ kbd> </ kbd>, Enter </ kbd> </ kbd>
-(Hatena Blog) I wanted to display Hello World on the console anyway in Java
that's all
Recommended Posts