Compiler version of Studio Creator 2 Update 1

Hi all!

I am new to Java and have just started learning. I downloaded Studio Creator, so that I can start playing with source code somewhere.

It does not recognize 'enum' declaration and I get the following error;

warning: as of release 1.5, 'enum' is a keyword, and may not be used as an identifier

(try -source 1.5 to use 'enum' as a keyword)

enum Roman {I, V, X, L, C, M }

Can somebody tell me please which compiler version Studio Creator uses?

Thanks a lot!

[516 byte] By [Drina] at [2007-11-27 7:52:52]
# 1
Hi,Creator2_1 is not yet opensource. For that you will have to wait till December (as VisualWebPack with NetBeans).dr.am.mohan rao
Madana at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...
# 2

Java Studio Creator includes the J2SE 1.5.0_06 JDK compiler.

In the "Sun Java Studio Creator 2 Update 1 Installation and Release Notes" at http://developers.sun.com/jscreator/reference/docs/2/Installation_ReleaseNotes_ 2_1-en.html, see the Note at the beginning of the "System Requirements" section for a list of bundled technologies.

BTW, Java Studio Creator source code has been contributed to the NetBeans open source project. Source derived from Creator was renamed NetBeans Visual Web Pack 5.5.

vaughna at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...
# 3
Vaughn,Thank you very much for your reply.I understand that 'enum' types are introduced as of J2SE 1.5, which means that Sun Java Studio Creator 2 Update 1 should recognize it. Instead, I get the compiler error mentioned above. Any idea why?Thank you.
Drina at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...
# 4

This is a general Java question, not specific to the IDE. I'll give a short answer, but if you need more help, go to the "New To Java" forum http://forum.java.sun.com/forum.jspa?forumID=54 or "Java Programming" forum http://forum.java.sun.com/forum.jspa?forumID=31.

Yes, "Enum" is a type already defined by the JDK, so that name can't be used as a variable name. Your error message suggests you tried to declare "Enum" as an identifier, but the JDK already declared it for a different purpose. Maybe you have a syntax error, or maybe an incomplete understanding of types. If this isn't enough of a clue, then repost your question with a snippet of the source that you wrote which triggered the error message.

vaughna at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...
# 5

Vaughn,

Here it is. Thank you.

class Stepper{

enum Roman {I, V, X, L, C, M }

public static void main (String... bang) {

int x = 7;

int z = 2;

Roman r = Roman.X;

do{

switch (r){

case C: r = Roman.L; break;

case X: r = Roman.C;

case L: if (r.ordinal() > 2) z += 5;

case M: x++;

}

z++;

} while (x < 10);

System.out.println(z);

}

}

Drina at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...
# 6

Make the following changes to the first 3 lines, and your class will run. If you have any more questions about this issue, go to the "New To Java" forum at http://forum.java.sun.com/forum.jspa?forumID=54.

//class Stepper{

//enum Roman {I, V, X, L, C, M }

//public static void main(String... bang) {

public class Stepper{

enum Roman {I, V, X, L, C, M };

public static void main(String[] args) {

vaughna at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...
# 7

One more suggestion: If you're just learning Java, get NetBeans 5.5.1 from http://www.netbeans.org/. It's an all-purpose IDE, while Creator is specialized for rapid development of web applications based on JSF. You can develop plain Java objects (POJOs) with Creator, but NetBeans is better for that purpose. Also, you can add most of Creator's JSF development features to Netbeans be installing the Netbeans Visual Web Pack.

vaughna at 2007-7-12 19:34:05 > top of Java-index,Development Tools,Java Tools...