Compiling and running Java, with bundled dependencies
<h2>Context</h2>

<p>I need to utilize Websockets, but the ancient version of PHP we're using doesn't support them. I've decided to try a Java Websocket server. I've written a handful of Android applications in Android Studio, so I'm familiar with the basic syntax of Java, but have very little experience compiling and running java-things manually.</p>

<p>I'd like the server to be a single file that I can run once from the command line and forget about. To that end, I've decided to use <a href="https://github.com/TooTallNate/Java-WebSocket" rel="nofollow">this library</a> which includes a Javascript chat app in the examples. I'm having trouble compiling and running the server for the example.</p>

<p>I'm on a Mac.</p>

<h2>What I tried</h2>

<ol>
<li>Copy the server (<code>src/main/example/ChatServer.java</code>) to the directory with the rest of the dependencies (<code>/src/main/java/org/java_websocket/</code>). </li>
<li>Move into the library directory: <code>cd ./src/main/java/org/java_websocket/</code></li>
<li>compile all library .java files and the ChatServer file into a jar: <code>jar cfv ChatServer.jar *</code></li>
<li>Run it: <code>java ChatServer</code></li>
<li>Receive error: </li>
</ol>

<blockquote>
  <p>Error: Could not find or load main class ChatServer</p>
</blockquote>

<h2>Question</h2>

<p>How can I compile <code>ChatServer.java</code> with all the dependencies into a single file that can be copied to the server and executed with a single command?</p>