h2oai / h2o-tutorials

Tutorials and training material for the H2O Machine Learning Platform
http://h2o.ai
1.48k stars 1.01k forks source link

h2o-tutorials/tutorials/mojo-resource/ - Could not find or load main class Main #161

Closed bvandorf closed 2 years ago

bvandorf commented 2 years ago

When building and running this tutorial there is an exception when tryring to run the model.

C:\Temp\h2o-tutorials-master\tutorials\mojo-resource>mvn compile [INFO] Scanning for projects... [INFO] [INFO] --------------------< com.nickkarpov:mojo-resource >-------------------- [INFO] Building mojo-resource 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mojo-resource --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mojo-resource --- [INFO] Nothing to compile - all classes are up to date [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.918 s [INFO] Finished at: 2022-08-07T19:15:27-05:00 [INFO] ------------------------------------------------------------------------

C:\Temp\h2o-tutorials-master\tutorials\mojo-resource>mvn package [INFO] Scanning for projects... [INFO] [INFO] --------------------< com.nickkarpov:mojo-resource >-------------------- [INFO] Building mojo-resource 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mojo-resource --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mojo-resource --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mojo-resource --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Temp\h2o-tutorials-master\tutorials\mojo-resource\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ mojo-resource --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mojo-resource --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ mojo-resource --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.435 s [INFO] Finished at: 2022-08-07T19:15:34-05:00 [INFO] ------------------------------------------------------------------------

C:\Temp\h2o-tutorials-master\tutorials\mojo-resource>java -cp target/mojo-resource-1.0-SNAPSHOT.jar:libs/* Main Error: Could not find or load main class Main Caused by: java.lang.ClassNotFoundException: Main

C:\Temp\h2o-tutorials-master\tutorials\mojo-resource>

bvandorf commented 2 years ago

also had to add this to the pom.xml to get mvn to build

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <maven.compiler.release>11</maven.compiler.release>
  </properties>
bvandorf commented 2 years ago

Update I did figure out what was wrong, on windows you have to replace the : with a ; java -cp target\mojo-resource-1.0-SNAPSHOT.jar;libs/* Main