简体   繁体   中英

Unable to find class in Maven project

As someone who has been programming in node.js for a while, finding a specific class has been tough and documentation online has been confusing for someone like me who hasn't had much experience with package dependency in Java.

First off, this is the command I am trying to run

mvn exec:java -Dexec.mainClass="gifClass"

I put a file called gifClass.java (with the class name being gifClass) in both the highest part of the project directory and the src folder. Nevertheless, I get a classNotFoundException: gifClass

Can anyone help me coming from node.js? Thanks!

Put your java source files into src/main/java directory (this is the root directory for Java sources, use subdirectories for Java packages).

See https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM