title: java.lang.ClassNotFoundException even though I specify -cp argument to the class file
body: <p>I'm not sure why I am having this issue. Here's what I'm running on linux command line:</p>
  
  <pre><code>sudo java -jar gs-rest-service-0.1.0.jar -cp ./hello
  java.lang.ClassNotFoundException: hello.Application
  
  sudo java -jar gs-rest-service-0.1.0.jar -cp hello
  java.lang.ClassNotFoundException: hello.Application
  </code></pre>
  
  <p>Tried it both ways, with the ./ and without. Also tried it like this: </p>
  
  <pre><code>sudo java -jar gs-rest-service-0.1.0.jar -cp ./main/java/hello
  java.lang.ClassNotFoundException: hello.Application
  </code></pre>
  
  <p>Again with and without the ./. When I view the jar file I see the Application.class file in main/java/hello all lower case. Here's my MANIFEST.MF</p>
  
  <pre><code>Manifest-Version: 1.0
  Class-Path: ./hello
  </code></pre>
  
  <p>Update: Got it working. Here I had an issue in my pom.xml file I had specified start-class as hello.Application but my package names I kept messing around with so they were never in sync and adding the -cp wasn't helping since now I would have package one thing in the classes, start-class in the pom.xml another, and -cp even in the wrong location on the command line! Argh.. Just a dumb night. </p>
  
  <p>Here's the working code:</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  &lt;artifactId&gt;gs-rest-service&lt;/artifactId&gt;
  &lt;version&gt;0.1.0&lt;/version&gt;
  &lt;packaging&gt;jar&lt;/packaging&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.0.2.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
      &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;properties&gt;
      &lt;start-class&gt;main.java.hello.Application&lt;/start-class&gt;
  &lt;/properties&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
      &lt;plugin&gt; 
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; 
          &lt;version&gt;2.3.2&lt;/version&gt; 
      &lt;/plugin&gt;
      &lt;plugin&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
      &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
      &lt;id&gt;spring-snapshots&lt;/id&gt;
      &lt;url&gt;http://repo.spring.io/libs-snapshot&lt;/url&gt;
      &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
      &lt;id&gt;spring-snapshots&lt;/id&gt;
      &lt;url&gt;http://repo.spring.io/libs-snapshot&lt;/url&gt;
      &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
      &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Application.java:</p>
  
  <pre><code>package main.java.hello;
  
  
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.boot.SpringApplication;
  import org.springframework.context.annotation.ComponentScan;
  
  @ComponentScan
  @EnableAutoConfiguration
  public class Application {
  
  public static void main(String[] args) {
      SpringApplication.run(Application.class, args);
  }
  }
  </code></pre>
  
  <p>All other java files have the same package name specified and used in the eclipse IDE. To get rid of the IDE showing red X's on everything I ran maven with this param: </p>
  
  <pre><code>mvn dependency:copy-dependencies
  </code></pre>
  
  <p>As described in this wonderful question here: </p>
  
  <p><a href="https://stackoverflow.com/questions/7908090/downloading-all-maven-dependencies-to-a-directory-not-in-repository">Downloading all maven dependencies to a directory NOT in repository?</a></p>
  
  <p>After downloaded I created a user library and pulled all jar files from the dependency directory that's created after maven does it's download thing. Thought I'd add that into the question. A bit out of scope but was helpful to get rid of further errors in the IDE that show up when editing a stupid simple hello world web service. </p>