title: Hosting a runnable jar file (Discord bot) on a web server (Heroku)
body: <p>I just finished creating a simple Discord bot in a runnable jar. (As a disclaimer, when it comes to the web, I'm a noob.) I was looking for a way to freely run it online and I read about all these VPS sites, but none of them offered unlimited free plans. So I stumbled into a site called Heroku, which allows me to run it for a good portion of the month. I've mostly figured everything out, but there is this one error that I've been unable to fix:</p>
  
  <pre><code>Error R10 (Boot timeout) -&gt; Web process failed to bind to $PORT within 90 seconds of launch
  </code></pre>
  
  <p>My Discord bot does not connect to Heroku's server and I think thats the problem, but I have no clue how to fix it. Has anyone encountered a similar problem? Am I going about hosting my bot the right way? Thanks.</p>
  
  <p>Edit: Here is the full logs:</p>
  
  <pre><code>2016-06-11T17:00:56.792783+00:00 app[web.1]: 17:00:56.792 [main] DEBUG d.btobastian.javacord.ImplDiscordAPI - Requested gateway wss://gateway.discord.gg (token: **************************************************NdxxxW0oQ)
  2016-06-11T17:00:56.765456+00:00 app[web.1]: 17:00:56.765 [main] DEBUG d.btobastian.javacord.ImplDiscordAPI - Requesting gateway (token: **************************************************NdxxxW0oQ)
  2016-06-11T17:00:57.199263+00:00 app[web.1]: 17:00:57.199 [ReadingThread] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Sending connect packet
  2016-06-11T17:00:57.267527+00:00 app[web.1]: 17:00:57.267 [ReadingThread] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Received READY-packet!
  2016-06-11T17:00:57.270636+00:00 app[web.1]: 17:00:57.270 [ReadingThread] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Updating status (game: none, idle: false)
  2016-06-11T17:01:38.508359+00:00 app[web.1]: 17:01:38.507 [pool-2-thread-1] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Sending heartbeat (interval: 41250)
  2016-06-11T17:02:19.751552+00:00 app[web.1]: 17:02:19.751 [pool-2-thread-1] DEBUG d.b.j.utils.DiscordWebsocketAdapter - Sending heartbeat (interval: 41250)
  2016-06-11T17:02:22.866430+00:00 heroku[web.1]: Error R10 (Boot timeout) -&gt; Web process failed to bind to $PORT within 90 seconds of launch
  2016-06-11T17:02:23.649874+00:00 heroku[web.1]: Process exited with status 137
  </code></pre>
  
  <p>So my application does not actually interact with the Heroku server and it "times out" appartently. When I run it locally, all is well, but when I upload it to a Heroku application, it "times out." I've looked for ways to bind the $PORT but been unsuccessful so far. I've inluded it in my Procfile with no results:</p>
  
  <pre><code>web: java $JAVA_OPTS -Dserver.port=$PORT -jar ideaprojects.jar --host=0.0.0.0 --port=$PORT
  </code></pre>
  
  <p>I've never interacted with ports before, can someone help me out? Thanks again.</p>
  
  <p>Edit2: I even tried to run my bot through their "java-getting-started" by adding my Java code to the end of theirs. Heroku doesn't crash, but it seems that my bot doesn't run either.</p>