![formdev install eclipse plugin formdev install eclipse plugin](http://sculptorgenerator.org/images/documentation/eclipse-plugin/editor.png)
In your specific case, the class file in question would probably be at target/classes/tr/edu/hacettepe/cs/b21127113/bil138_4/App.class because maven compiles to target/classes, and java traditionally creates a directory for each level of packaging.
![formdev install eclipse plugin formdev install eclipse plugin](https://www.eclipse.org/articles/Article-Forms/images/intro.gif)
A class name generally translates directly to a class file that's found in the class path, as compared to a source file in the file system.
![formdev install eclipse plugin formdev install eclipse plugin](https://marketplace.eclipse.org/sites/all/themes/solstice/public/images/marketplace/help.png)
What you were trying to use was a file system path to a source file.
#FORMDEV INSTALL ECLIPSE PLUGIN FULL#
The fully-qualified name is the full package plus the simple class name, and that's what you give to maven or java when you want to run something. The simple class name is just the last part: App in your case.
![formdev install eclipse plugin formdev install eclipse plugin](https://marketplace.eclipse.org/sites/default/files/how-drap-an-drop-to-install.png)
When talking about class names, they're (almost) always dot-separated. Update: First, regarding your error when running exec:java, your main class is tr.b21127113.bil138_4.App. To verify that your maven config is correct, you could run your app with the exec plugin using: mvn exec:java -D exec.mainClass= See the m2eclipse plugin for integrating maven with eclipse for that. Run it how? You're probably trying to run it with eclipse without having correctly imported your maven classpath. When I try to run it, I get NoClassDefFoundError If you want to do further configuration of the shade plugin in terms of what JARs should be included, specifying a Main-Class for an executable JAR file, and so on, see the "Examples" section on the maven-shade-plugin site. Once this is done, you can rerun the commands you used above: $ mvn package To simply bundle all required libraries, add the following to your POM:
#FORMDEV INSTALL ECLIPSE PLUGIN CODE#
You need to register it in your POM, and it will automatically build an "uber-JAR" containing your classes and the classes for your library code too when you run mvn package. There is a Maven plugin called the maven-shade-plugin to do this. You could manually specify the libraries on the classpath with the -cp parameter, but that quickly becomes tiresome.Ī better solution is to "shade" the library code into your output JAR file. This is why the Java VM can't find the library class files when trying to execute your code. It downloads dependencies, successfully builds, but when I try to run it, I get NoClassDefFoundError: Exception in thread "main" : org/codehaus/jackson/JsonParseExceptionĪt tr.b21127113.bil138_4.db.DatabaseManager.(DatabaseManager.java:16)Īt tr.b21127113.bil138_4.db.DatabaseManager.(DatabaseManager.java:22)Īt tr.b21127113.bil138_4.App.main(App.java:10)Ĭaused by: : Īt $1.run(URLClassLoader.java:217)Īt (Native Method)Īt (URLClassLoader.java:205)Īt (ClassLoader.java:321)Īt $AppClassLoader.loadClass(Launcher.java:294)Īt (ClassLoader.java:266)īy default, Maven doesn't bundle dependencies in the JAR file it builds, and you're not providing them on the classpath when you're trying to execute your JAR file at the command-line. $ java -cp target/bil138_4-0.0.1-SNAPSHOT.jar tr.b21127113.bil138_4.App # NoClassDefFoundError for dependencies I created a Maven project with Eclipse and added dependencies, and it was working without problems.īut when I try to run it via command line: $ mvn package # successfully completes My first use of Maven and I'm stuck with dependencies.