Hi i Have a maven project used three libraries: junit, commons-lang, org.apache.commons My program is located in location pl.parser.example.MainClass (with main method) and three others : Currency.java, CurrencyPojo.java, CurrencyRates.java
My main method:
 public static void main(String[] args){
  try {
    String type = "c";
    String currencyCode = args[0];
    String inputStartDate = args[1];
    String inputEndDate = args[2];
...
I can't run this program from command line, i build it with maven to jar file and try:
java -cp AreYouExample.jar pl.parser.example.MainClass EUR 2013-01-28 2013-01-31
But i got exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/ma
th3/stat/descriptive/DescriptiveStatistics
        at pl.parser.example.CurrencyRates.obtainAvgPurchaseRate(
CurrencyRates.java:33)
        at pl.parser.example.MainClass.main(MainClass.java:34)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.math3.stat.descr
iptive.DescriptiveStatistics
        at java.net.URLClassLoader$1.run(Unknown Source)...
I think that runner can't see library which i used in program (to get averange count from math)
I don'thave a manifest file, and classpath file. When I tried run jar with:
    ...> java MainClass EUR 2013-01-28 2013-01-31
Then i got exception:
Error: Could not find or load main class MainClass.java
But when i will go to folder with MainClass.java and run javaC MainClass.java... Then compiller cant find symbols used in program because sumbols are located in other class (in this folder/package)
I think that i should insert a main class i suggested this case in stack overflow, build in pom file but that not works.
EDIT: Now it works, i made a change in POM file like in other overstackflow topic I insertet this code:
<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.0</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <transformers>
            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
              <mainClass>your.main.Class</mainClass>
            </transformer>
          </transformers>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>
 
     
     
     
     
    