I found a lot helpful videos and documentation on how to run Java code in Windows and Command Prompt, but not much for Mac users.
You can copy this code below:
public class Hello
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
/** This is a multi line comment for reference.
How to complie and run this Java file on Mac in Terminal
1. save java file as filename.java in the JavaApps folder in /Users/yourmacsname/JavaApps/
2. Open Terminal
3. type "cd ~" into terminal
4. type "ls" into terminal
5. type "cd JavaApps" into terminal
6. type "javac filename.java" into terminal
7. type "java " + "the name of the class you want to run"
More very helpful Info
https://stackoverflow.com/questions/2...
https://www.macworld.com/article/2042...
terminal should look like this
name-MBP:JavaApps philippounds$ cd ~
name-MBP:~ philippounds$ ls
Creative Cloud Files Music ez_setup.py
Desktop Pictures get-pip.py
Documents Public iCloud Drive (Archive)
Downloads PycharmProjects mm.cfg
HelloApp.class Rplot.png myproject
HelloApp.java StencylWorks.prefs setuptools-33.1.1.zip
JavaApps Untitled.R stencylworks
Library Untitled.html.rtf venv
Movies VirtualBox VMs
name-MBP:~ philippounds$ cd JavaApps
name-MBP:JavaApps philippounds$ javac Hello.java
name-MBP:JavaApps philippounds$ java Hello
Hello World
name-MBP:JavaApps philippounds$
**/