Run the Java java project via terminal?

0

I did a Maven project in Eclipse, I installed a dependency of Mahout for pom.xml, I made the code and it works beauty, it's beautiful. But I have to run this in a virtual machine, that is without Eclipse. How do I run my project on the virtual machine? I have a small experience in java I know that an executable is generated, but what exactly do I have to pass to the virtual machine and how to run via terminal?

The tree of my project is this, my main code is in App.java. data.csv is the input file, the rest was automatically generated.

Recommender/
├── data
│   └── data.csv
├── pom.xml
├── src
│   ├── main
│   │   └── java
│   │       └── com
│   │           └── predict
│   │               └── Recommender
│   │                   └── App.java
│   └── test
│       └── java
│           └── com
│               └── predict
│                   └── Recommender
│                       └── AppTest.java
└── target
    ├── classes
    │   ├── com
    │   │   └── predict
    │   │       └── Recommender
    │   │           └── App.class
    │   └── META-INF
    │       ├── MANIFEST.MF
    │       └── maven
    │           └── com.predict
    │               └── Recommender
    │                   ├── pom.properties
    │                   └── pom.xml
    └── test-classes
        └── com
            └── predict
                └── Recommender
                     └── AppTest.class

I installed maven on the virtual machine I ran Hello World so I added my code inside the App.java and added the dependency inside the pom.xml and executed the following code:

mvn package

java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App

But mine gave the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/mahout/cf/taste/model/DataModel
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at 
 sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at 
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: 
org.apache.mahout.cf.taste.model.DataModel
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more
    
asked by anonymous 12.01.2018 / 14:36

0 answers