Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:02:18+00:00 2026-06-17T09:02:18+00:00

Trying to run Java7 Hello World Project from command line with maven.. If I

  • 0

Trying to run Java7 Hello World Project from command line with maven.. If I run the code from within eclipse my project runs ok but if I try to do a “mvn packege” package I get the following error..

Here is my source:

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!, Tesing Java 7" );
        printDay("Wednesday");
    }

    public static void printDay(String dayOfWeek) {
        switch (dayOfWeek) 
        {
            case "Sunday": System.out.println("Dimanche"); break;
            case "Monday": System.out.println("Lundi"); break;
            case "Tuesday": System.out.println("Mardi"); break;
            case "Wednesday": System.out.println("Mercredi"); break;
            case "Thursday": System.out.println("Jeudi"); break;
            case "Friday": System.out.println("Vendredi"); break;
            case "Saturday": System.out.println("Samedi"); break;

            default: System.out.println("Error: '"+ dayOfWeek +"' is not a day of the week"); break;
        }
    }
}

Here is my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.smith</groupId>
  <artifactId>TestJava7</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>TestJava7</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

Here IS THE ERROR:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/jsmith/Documents/workspace-juno/TestJava7/src/main/java/org/smith/TestJava7/App.java:[16,13] error: strings in switch are not supported in -source 1.5
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.169s
[INFO] Finished at: Wed Jan 16 09:48:26 EST 2013
[INFO] Final Memory: 10M/100M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project TestJava7: Compilation failure
[ERROR] /home/jsmith/Documents/workspace-juno/TestJava7/src/main/java/org/smith/TestJava7/App.java:[16,13] error: strings in switch are not supported in -source 1.5
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:02:19+00:00Added an answer on June 17, 2026 at 9:02 am

    Set version of source and target for the comiler plugin:

    http://maven.apache.org/plugins/maven-compiler-plugin/

    <project>
      [...]
      <build>
        [...]
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.0</version>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
          </plugin>
        </plugins>
        [...]
      </build>
      [...]
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run a Hello World Struts2 project in Tomcat 6. I
I'm trying to run a jar file from Java code, through exec(). The jar
I'm trying to run exec-maven-plugin 's exec:java goal on a simple two-module project where
I am trying to run the simplest Hello World example app and looks like
I'm trying to get the simplest Hadoop hello world setup to work, but when
I am trying to run my first hello world application on the 2.3.1 emulator
I'm trying to run the sample code from this Sun tutorial: http://download.oracle.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html I've copied
I am trying to launch the default Hello World app but after I launch
I am trying to run a simple program hello world in my android mobile.
Trying to develop hello world, but getting force close error on emulator. thanks in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.