0

After Installing Java in my computer I'm getting the following error in NetBeans

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Project1: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. For more information about the errors and possible solutions, please read the following articles:[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

after running the following code

public class Class1 {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
    
        System.out.println("What is your name?");
        String name = scan.nextLine();
        System.out.println("Your name is " + name);
    }
}

If I only run the System.out.println("What is your name?"); line of code, the program works perfectly.


I have found the same (or similar) mistake in multiple posts in this website, but I'm so new to programming that I do not understand the answers. For example, in this post the most upvoted answer states that "As it turned out, I ran mvn clean package install. Correct way is mvn clean install", and in the comments he follows that " I ran the command in the command line. As I remember, Eclipse allows to create build tasks."

I've been trying to figure out what some of the answers mean without much success. Could someone explain to a beginner-level programmer how this issue is to be solved?

Sam
  • 315
  • 1
  • 3
  • 14
  • 1
    new to programming? Why do you need maven for this "hello world" example? Just create a Java Project without maven to learn. Then you can learn fully about maven later. –  Dec 29 '20 at 14:46
  • Please add your pom.xml and the command you ran to your question. – tgdavies Dec 30 '20 at 04:20

0 Answers0