Question: How do I compile and run a program in Java on my mac? 

I'm new.

Also I downloaded a program that was suggested to me on here called text wrangler if that has any bearing on the situation.

Answer: 
I will give you steps to writing and compiling code.
Use this example:

```
 public class Paycheck {
    public static void main(String args[]) {
        double amountInAccount;
        amountInAccount = 128.57;
        System.out.print("You earned $");
        System.out.print(amountInAccount);
        System.out.println(" at work today.");
    }
}

```

1. Save the code as `Paycheck.java`
2. Go to terminal and type `cd Desktop`
3. Type `javac Paycheck.java`
4. Type `java Paycheck`
5. Enjoy your program!
Other solutions are good enough to answer your query. However, if you are looking for just one command to do that for you - 

Create a file name "run", in directory where your Java files are. And save this in your file -

```
javac "$1.java"
if [ $? -eq 0 ]; then
  echo "--------Run output-------"
  java "$1"
fi

```

give this file run permission by running -

```
chmod 777 

```

Now you can run any of your files by merely running - 

```
./run <yourfilename> (don't add .java in filename)

```