Java 5 help?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Java 5 help?

  1. #1
    Join Date
    Nov 2004
    Location
    Montreal/Laval
    Posts
    1

    Java 5 help?

    Hello,
    I seem to be having trouble running the new enhanced loops.

    here is the set-up:
    ---------------------------------------
    java version "1.5.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
    Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)


    JAVA_HOME = C:\Program Files\Java\jdk1.5.0

    PATH = C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Java\jdk1.5.0\bin

    WinXP Pro
    -----------------------------------------

    Code I am trying to run:
    ------------------------------------
    public class JavaFive {

    public static void main(String[] args) {
    String[] A = new String[] {"tim","buck","too","zoo","joo"};
    --line 18---> for (String s : A){
    System.out.println(s);

    }
    }
    }

    -------------------------------------

    Error = Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    Syntax error on token(s), misplaced construct(s)
    Syntax error on token ")", : expected

    at org.redrum.tests.JavaFive.main(JavaFive.java:18)


    anyone now whats up??
    Cheers,
    Espersso /*Terry*/

  2. #2
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    Hi Terry,

    I have just tried your code using exactly the same JVM (1.5.0) on XP Pro and it works fine.

    This is the program I have just run

    Code:
    public class JavaFive
    {
        
        public static void main(String[] args)
        {
            String[] A = new String[] {"tim","buck","too","zoo","joo"};
            for (String s : A)
            {
                System.out.println(s);
            }
        }
    }
    I can only think that you somehow are running the wrong JVM.

    Sorry I cannot help further.
    Graham

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center