ich habe folgendene Datei angelegt mit "Eclipse Helios". Leider meckert
Java:
Zeile mit Enum:Thepublic type Day must be defined in its own file
Zeile mit importclass:Multiple markers at this line
-The type java.lang.Enum cannot be resolved.It is indirectly
referenced from required .class files
-The type Enum is not generic; it cannot be parameterized with
arguments <Day>-The type java.lang.Enum cannot be resolved.It is indirectly
referenced from required .class files
warum?! wenn ich richtig verstanden habe will eclipse die enum Liste wo anderes haben/in einem exernen file?
hier ist mein quellcode
Java:
importjava.util.*;publicenumDay{
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}publicclassEnumTest{Day day;publicEnumTest(Day day){this.day = day;}publicvoidtellItLikeItIs(){switch(day){case MONDAY:System.out.println("Mondays are bad.");break;case FRIDAY:System.out.println("Fridays are better.");break;case SATURDAY:case SUNDAY:System.out.println("Weekends are best.");break;default:System.out.println("Midweek days are so-so.");break;}}publicstaticvoidmain(String[] args){EnumTest firstDay =newEnumTest(Day.MONDAY);
firstDay.tellItLikeItIs();EnumTest thirdDay =newEnumTest(Day.WEDNESDAY);
thirdDay.tellItLikeItIs();EnumTest fifthDay =newEnumTest(Day.FRIDAY);
fifthDay.tellItLikeItIs();EnumTest sixthDay =newEnumTest(Day.SATURDAY);
sixthDay.tellItLikeItIs();EnumTest seventhDay =newEnumTest(Day.SUNDAY);
seventhDay.tellItLikeItIs();}}
hallo tfa!
sorry bin ein newby kannst Du bitte erklären wie man das macht. Muss ich ein .java file anlegen und in dieses enum kopieren?
Muss ich beim kompilieren etwas beachten und wie "includiere" ich den file. DANKE!
die eine Fehlermeldung wird jetzt nicht mehr angezeigt was aber noch bleibt die Meldung
Java:
Multiple markers at this line
-The type Enum is not generic; it cannot be parameterized with
arguments <EnumTest.Day>-The type java.lang.Enum cannot be resolved.It is indirectly
referenced from required .class files
-The type java.lang.Enum cannot be resolved.It is indirectly
referenced from required .class files
Es kommt tatsächlich auf die Java version an bzw. Bibliotheken an.
Man kann diese Fehlermeldung los werden wenn die jre6 zum Beispiel verwendet wird.
Problem: falsche Bibliothek wird verwendet!
Lösung für eclipse:
Project-> Properties -> Java build path -> Libraries -> die aktuelle version checken, wenn 1.4 -> Edit -> Alternate (6 wählen, diese muss jedoch installiert sein)