aws-samples / aws-java-sample

Sample project to demonstrate usage of the AWS SDK for Java
Apache License 2.0
231 stars 339 forks source link

class not found exception when compiling #9

Closed smillerk2 closed 9 years ago

smillerk2 commented 9 years ago

I'm running Win7 64bit and have installed maven and the Java SDK. When running mvn package the AWS packages are downloaded and everything seems fine.

When I run mvn clean compile exec:java, I end up with this:

[INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ aws-java-sample


[INFO] Nothing to compile - all classes are up to date [INFO] [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ aws-java-samp le >>> [INFO] [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ aws-java-samp le <<< [INFO] [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ aws-java-sample --- [WARNING] java.lang.ClassNotFoundException: com.amazonaws.samples.S3Sample at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285) at java.lang.Thread.run(Thread.java:745)

Also, the credentials text file is copied to the /target/classes/ folder.

What I am doing wrong or missing? Do I need to remove CLASSPATH from my Windows environment variables?

smillerk2 commented 9 years ago

Found the issue. Source *.java file was misnamed. Appears to work fine now. Thanks.