'How can I run Java code contained in a .txt file?

How do you run code in a .txt file?

I know you're supposed to use a terminal, but it keeps giving this message:

javac: file not found: hii.java
Usage: javac <options> <source files>
use -help for a list of possible options

I saved my .txt file on the desktop.



Solution 1:[1]

After reading this, I cannot even think of where to start.

Just try something like JCreator Lite Edition (LE), and try to work in it for a bit.

While it is loading, I suggest reading something like this. You have to be in the same working directory as your file when you run that command.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Mortensen