• Post Reply Bookmark Topic Watch Topic
  • New Topic

for-each loops are not supported in -source 1.4  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Need Help for this

An error appeared on my code that says:



But my sdk version is JDK 1.6.

I am completely lost right now. Need Help. Thanks in advance!
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the switch "-source 1.4" means that the compiler should pretend the source code in Java version 1.4, in which (among other things) for-each loops didn't exist. Why are you using that switch if you want to use new source code that uses JDK 1.5 features?
 
Kiss Pepet
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I know if my compiler is using switch. I am too noobish, i am not completely aware of this.

Is there a way to disable the switch thingy?

Thanks!
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kiss Pepet wrote:How would I know if my compiler is using switch. I am too noobish, i am not completely aware of this.
Is there a way to disable the switch thingy?


Your compiler doesn't use the switch without your explicitly telling it to. Or are you using an IDE? If so, you'd best check the IDE's help files and other documentations on how to set the compiler compliance level.
 
Kiss Pepet
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pete stein wrote:
Kiss Pepet wrote:How would I know if my compiler is using switch. I am too noobish, i am not completely aware of this.
Is there a way to disable the switch thingy?


Your compiler doesn't use the switch without your explicitly telling it to. Or are you using an IDE? If so, you'd best check the IDE's help files and other documentations on how to set the compiler compliance level.


Hey! Thanks! Problem already resolved!

I am using Netbeans 6.8 as an IDE and set the <b>Source/Binary Format<b> to JDK 6

Now I can user generics too!

Thanks for those immediate replies
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kiss Pepet wrote:Hey! Thanks! Problem already resolved!
.....
Thanks for those immediate replies


Wonderful and congratulations!
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch

If you are a real beginner, avoid using IDEs like NetBeans. Use the command line instead.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!