Nihal Jalaluddin P Nihal Jalaluddin P - 3 months ago 18x
Java Question

Can't switch to compiler compliance level 1.8 in Eclipse Helios

I am pretty new to eclipse and programming,Currently i am trying to learn java from a tutorial from
When i was trying to follow one tutorial based on switch an error keep disturbing me.

import java.util.Scanner;

public class App{

public static void main(String[] args){

Scanner input = new Scanner(;

System.out.println("enter a number");

String text = input.nextLine();

switch(text) {

case "start";

System.out.println("Machine started");

break; } } }

And it gives me an error on the switch command saying:

cannot switch on a value of type string. only int values or enum constants are permitted

John Purcell at suggested that its because of the compiler compliance level which is currently 1.4 and he said me to switch that to 1.8 but its not available there.1.6 is the last level which i can use.


Download and install the current Eclipse version. Eclipse has a build-in Java compiler. Switching on Strings was added in Java SE 1.7. Java SE 1.4 is a very old version of Java. It's not a good idea to learn programming using a version of Java which is that old.

Also, as the other answer suggests, install the latest JDK.