Syntax error: annotations are only available if source level is 5.0

In eclipse, I am trying a hello world JMS tutorial.
In the code below, it doesn't like the @ sign for some reason... And I don't know how to make it happy....
It give this error:
Syntax error: annotations are only available if source level is 5.0
--------------code------------
public class MessageSender {
   @Resource(mappedName = "jms/GlassFishBookConnectionFactory")
   private static ConnectionFactory connectionFactory;
Here is my path if that helps.
Path=C:\oracle\product\10.2.0\client_1\bin;C:\Program Files (x86)\Java\jre8\bin;c:\glassfish4\glassfish\bin;C:\Program Files (x86)\Java\jdk1.8.0\bin
Thanks for any leads!
Jim

It give this error:
Syntax error: annotations are only available if source level is 5.0
That exception is telling you that the java compiler version being used to compile your java source is not 5.0 or later.
Eclipse uses 'some' version of Java to run itself. And, by default, your java code will use that same version of java unless you configure it to use a different version.
http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM
One of the most recommended options to use is to specify a specific JVM for Eclipse to run on. Doing this ensures that you are absolutely certain which JVM Eclipse will run in and insulates you from system changes that can alter the "default" JVM for your system. Many a user has been tripped up because they thought they knew what JVM would be used by default, but they thought wrong. eclipse.ini lets you be CERTAIN.
Check the version of java that eclipse is using. Just because that version of java is not on your path doesn't mean eclipse isn't using it.
Then repost your question in an eclipse forum.

Similar Messages

  • Error -annotations are not supported in -source 1.3

    Hi friends, when I try to compile my src code using ANT ,
    it gives me this error :
    annotations are not supported in -source 1.3 -
    use -source 5 or higher to enable annotations)
                   @Override
    ^
    what is source 5...? If it is a jdk version than I am using jdk 1.6.X
    Plz help

    ANT is apparently compiling with the -source 1.3 option, meaning that the code must be compatible with java 1.3. Check the declaration of the javac ant task in your build file. It should have something like this:
    <javac source="1.3" ../>remove that attribute.

  • Maven giving "annotations are not supported in -source 1.3" for  @Entity

    I m using maven for spring, hibernate with jpa . When i m running comman "mvn clean install" ,it is giving error in compilation of a bean class which is using jpa annotations.The error is :
    annotations are not supported in -source 1.3
    (use -source 5 or higher to enable annotations)
    @Entity
    Pom.xml is as below :
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.niit.core</groupId>
    <artifactId>Spring3Example</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>Spring3Example</name>
    <url>http://maven.apache.org</url>
    <properties>
    <org.springframework-version>3.1.2.RELEASE</org.springframework-version>
    </properties>
    <repositories>
    <repository>
    <id>JBoss Repo</id>
    <url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases</url>
    </repository>
    </repositories>
    <build>
    <plugins>
    <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.0</version>
    </plugin>
    </plugins>
    </build>
    <dependencies>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${org.springframework-version}</version>
    </dependency>
    <!-- <dependency>
    <groupId>hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>1.8.0.2</version>
    </dependency>
    -->
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>3.6.10.Final</version>
    </dependency>
    <dependency>
    <groupId>org.hibernate.java-persistence</groupId>
    <artifactId>jpa-api</artifactId>
    <version>2.0-cr-1</version>
    </dependency>
    <dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>3.5.0-Beta-2</version>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    </dependency>
    </dependencies>
    </project>
    And class is as below :
    package com.niit.form;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.Table;
    @Entity
    @Table(name="CONTACTS")
    public class Contact {
    @Id
    @Column(name="ID")
    @GeneratedValue
    private Integer id;
    @Column(name="FIRSTNAME")
    private String firstname;
    public String getFirstname() {
    return firstname;
    public void setFirstname(String firstname) {
    this.firstname = firstname;
    public void setLastname(String lastname) {
    this.lastname = lastname;
    public Integer getId() {
    return id;
    public void setId(Integer id) {
    this.id = id;
    }

    java version is 1.6.0_24
    There is no settings.xml in users/.m2
    I think , maven is using default settings.xml which is in M2_HOME\conf which has everything commented as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements. See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership. The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License. You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied. See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
    <!--
    | This is the configuration file for Maven. It can be specified at two levels:
    |
    | 1. User Level. This settings.xml file provides configuration for a single user,
    | and is normally provided in $HOME/.m2/settings.xml.
    |
    | NOTE: This location can be overridden with the system property:
    |
    | -Dorg.apache.maven.user-settings=/path/to/user/settings.xml
    |
    | 2. Global Level. This settings.xml file provides configuration for all maven
    | users on a machine (assuming they're all using the same maven
    | installation). It's normally provided in
    | ${maven.home}/conf/settings.xml.
    |
    | NOTE: This location can be overridden with the system property:
    |
    | -Dorg.apache.maven.global-settings=/path/to/global/settings.xml
    |
    | The sections in this sample file are intended to give you a running start at
    | getting the most out of your Maven installation. Where appropriate, the default
    | values (values used when the setting is not specified) are provided.
    |
    |-->
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!-- localRepository
    | The path to the local repository maven will use to store artifacts.
    |
    | Default: ~/.m2/repository
    <localRepository>/path/to/local/repo</localRepository>
    -->
    <!-- interactiveMode
    | This will determine whether maven prompts you when it needs input. If set to false,
    | maven will use a sensible default value, perhaps based on some other setting, for
    | the parameter in question.
    |
    | Default: true
    <interactiveMode>true</interactiveMode>
    -->
    <!-- offline
    | Determines whether maven should attempt to connect to the network when executing a build.
    | This will have an effect on artifact downloads, artifact deployment, and others.
    |
    | Default: false
    <offline>false</offline>
    -->
    <!-- pluginGroups
    | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
    | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
    | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
    |-->
    <pluginGroups>
    <!-- pluginGroup
    | Specifies a further group identifier to use for plugin lookup.
    <pluginGroup>com.your.plugins</pluginGroup>
    -->
    </pluginGroups>
    <!-- proxies
    | This is a list of proxies which can be used on this machine to connect to the network.
    | Unless otherwise specified (by system property or command-line switch), the first proxy
    | specification in this list marked as active will be used.
    |-->
    <proxies>
    <!-- proxy
    | Specification for one proxy, to be used in connecting to the network.
    |
    <proxy>
    <id>optional</id>
    <active>true</active>
    <protocol>http</protocol>
    <username>proxyuser</username>
    <password>proxypass</password>
    <host>proxy.host.net</host>
    <port>80</port>
    <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
    </proxies>
    <!-- servers
    | This is a list of authentication profiles, keyed by the server-id used within the system.
    | Authentication profiles can be used whenever maven must make a connection to a remote server.
    |-->
    <servers>
    <!-- server
    | Specifies the authentication information to use when connecting to a particular server, identified by
    | a unique name within the system (referred to by the 'id' attribute below).
    |
    | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
    | used together.
    |
    <server>
    <id>deploymentRepo</id>
    <username>repouser</username>
    <password>repopwd</password>
    </server>
    -->
    <!-- Another sample, using keys to authenticate.
    <server>
    <id>siteServer</id>
    <privateKey>/path/to/private/key</privateKey>
    <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
    </servers>
    <!-- mirrors
    | This is a list of mirrors to be used in downloading artifacts from remote repositories.
    |
    | It works like this: a POM may declare a repository to use in resolving certain artifacts.
    | However, this repository may have problems with heavy traffic at times, so people have mirrored
    | it to several places.
    |
    | That repository definition will have a unique id, so we can create a mirror reference for that
    | repository, to be used as an alternate download site. The mirror site will be the preferred
    | server for that repository.
    |-->
    <mirrors>
    <!-- mirror
    | Specifies a repository mirror site to use instead of a given repository. The repository that
    | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
    | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
    |
    <mirror>
    <id>mirrorId</id>
    <mirrorOf>repositoryId</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://my.repository.com/repo/path</url>
    </mirror>
    -->
    </mirrors>
    <!-- profiles
    | This is a list of profiles which can be activated in a variety of ways, and which can modify
    | the build process. Profiles provided in the settings.xml are intended to provide local machine-
    | specific paths and repository locations which allow the build to work in the local environment.
    |
    | For example, if you have an integration testing plugin - like cactus - that needs to know where
    | your Tomcat instance is installed, you can provide a variable here such that the variable is
    | dereferenced during the build process to configure the cactus plugin.
    |
    | As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
    | section of this document (settings.xml) - will be discussed later. Another way essentially
    | relies on the detection of a system property, either matching a particular value for the property,
    | or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
    | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
    | Finally, the list of active profiles can be specified directly from the command line.
    |
    | NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
    | repositories, plugin repositories, and free-form properties to be used as configuration
    | variables for plugins in the POM.
    |
    |-->
    <profiles>
    <!-- profile
    | Specifies a set of introductions to the build process, to be activated using one or more of the
    | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
    | or the command line, profiles have to have an ID that is unique.
    |
    | An encouraged best practice for profile identification is to use a consistent naming convention
    | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
    | This will make it more intuitive to understand what the set of introduced profiles is attempting
    | to accomplish, particularly when you only have a list of profile id's for debug.
    |
    | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
    <profile>
    <id>jdk-1.4</id>
    <activation>
    <jdk>1.4</jdk>
    </activation>
    <repositories>
    <repository>
    <id>jdk14</id>
    <name>Repository for JDK 1.4 builds</name>
    <url>http://www.myhost.com/maven/jdk14</url>
    <layout>default</layout>
    <snapshotPolicy>always</snapshotPolicy>
    </repository>
    </repositories>
    </profile>
    -->
    <!--
    | Here is another profile, activated by the system property 'target-env' with a value of 'dev',
    | which provides a specific path to the Tomcat instance. To use this, your plugin configuration
    | might hypothetically look like:
    |
    | ...
    | <plugin>
    | <groupId>org.myco.myplugins</groupId>
    | <artifactId>myplugin</artifactId>
    |
    | <configuration>
    | <tomcatLocation>${tomcatPath}</tomcatLocation>
    | </configuration>
    | </plugin>
    | ...
    |
    | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
    | anything, you could just leave off the <value/> inside the activation-property.
    |
    <profile>
    <id>env-dev</id>
    <activation>
    <property>
    <name>target-env</name>
    <value>dev</value>
    </property>
    </activation>
    <properties>
    <tomcatPath>/path/to/tomcat/instance</tomcatPath>
    </properties>
    </profile>
    -->
    </profiles>
    <!-- activeProfiles
    | List of profiles that are active for all builds.
    |
    <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
    </activeProfiles>
    -->
    </settings>

  • Business Rule error: Accounts are not available in the rule table

    Hi everybody,
    I have a problem running the Business Rule for the profit/loss copy to the equity account.
    The Business Rule I set reads from all P&L accounts, P&L specific flow, acual category, all datasources and then it writes everything keeping the source settings apart from the account destination (the equity profit/loss account) and the flow destination (I write in two different flows, so the rule is made up of two equal lines differing only in the flow destination). "PROFIT" is the ID I chose.
    Then I created the related script logic (ID=CALCACCOUNT):
    *RUN_PROGRAM CALC_ACCOUNT
    CATEGORY_M = %CATEGORY_M_SET%
    CURRENCYLABEL = %CURRENCYLABEL_SET%
    TID_RA = %TIME_SET%
    CALC=PROFIT
    *ENDRUN_PROGRAM
    Finally, the prompt ( process chain: CPMB/RUNCALCACCOUNT):
    PROMPT(SELECTINPUT,,,,"CATEGORY_M,CURRENCYLABEL,TIME")
    TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SUSER,%USER%)
    TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SAPPSET,%APPSET%)
    TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SAPP,%APP%)
    TASK(/CPMB/RUNCALCACCOUNT_LOGIC,SELECTION,%SELECTION%)
    TASK(/CPMB/RUNCALCACCOUNT_LOGIC,LOGICFILENAME,CALCACCOUNT.LGF)
    But anytime I run the package it fails giving me the message error: "Accounts are not available in the rule table".
    I tried every possible change but nothing; if someone could help me somehow I'd be really grateful!!
    Thanks
    Filippo

    Hi James,
    Thanks for your quick response. There is no currency dimension in the application... I've tested with the correct businessrule as CALC value, but this didn't do the trick.
    Any other suggestions?
    Regards,
    Vincent

  • Edits will not be saved. Any Edits made to the enterprise global template items are only available during this session.

    Hi,
    I am getting a pop-up message(Edits will not be saved. Any Edits made to the enterprise global template items are only available during this session.Make edits in checked-out enterprise global template to make them
    available for all users of this project server) when trying to insert a new column in the Gannt Chart View.
    Due to this what all are the columns that inserted in the project plan, will be lost when open the project in the next time.
    I have opened the Enterprise Global Template and cross checked for Gaant Chart view it is showing the table as "Entry" only.
    The requirement is what all columns are required for the project plan, manager will insert in the project first time. Next time on-wards it needs to be display the columns when opened the project from server by default.
    We are unable to reproduce this issue in our Dev Envt.
    Could anyone of you please help me.
    Thanks in Advance!
    Regards,
    Venkat

    Hi Venkat,
    I suggest to remove Gantt Chart view and Entry table from Eglobal. These are default views from client and it is highly recommended to not use them in Enterprise Global.
    Whatever a user ist doing on a view or table which is included in Enterprise Global will be reset on next open - therefore you receive this message.
    If you need some server wide defined views and tables, create them. But remove Gantt Chart and Entry.
    Does that help?
    Regards
    Barbara
    To increase the value of this forum, please mark the replies that helped to solve your issue as answer. If you find answers to questions from other forum participants to be helpful, please mark them as helpful. Your participation will help others to find
    an appropriate solution faster. Thanks for your support!

  • Is it possible that theseproperties are only available for files and not f

    Hello All,
    I have created few properties like ReqNo (takes Integer) and ReqDate (accepts Date). 
    I have set the above 2 properties as manadatory. Created a Group and added his goug in 'allgroups' such that I see a tab wherein I can fill in these properties.
    My questions is:
    <b>Is it possible that these properties are only available for files and not for folders</b>. The reason being that even if I create a new folder, I need to fill some values in the above two mentioned properties.
    These properties need to be mandatory and cannot make them optional.
    Please help me solve this mystery.
    Awaiting Reply.
    Thanks and Warm Regards,
    Ritu

    Hi Ritu,
    If you only want the property to be available for files and not folders you only enter data into the "Document Validity Patterns" field in the Property config.
    Regards
    Paul

  • Music downloads to iPod Nano from songs that are only available in iCloud.

    I'm trying to add music to my sons iPod Nano that myself and my older son have on our iPhone and iPod touch. When I try to copy these songs over to the Nano it tells me it cannot be copied because it is only available in iCloud. It then states I need to download the items from iCloud before they can be copied to the iPod. How to I download songs from iCloud that are currently showing in my music library?

    See these previous discussions:
    https://discussions.apple.com/thread/5611266?tstart=0
    https://discussions.apple.com/thread/5711119
    https://discussions.apple.com/thread/5693855?tstart=30
    https://discussions.apple.com/thread/5397140

  • Which Features are Only Available on the Driver

    Browsing through the forums, I've found out that the nice Audio Console is only found on the driver CD and not available to download. Are there any other features that can't be downloaded? I personally don't like this implementation because I like installing all my drivers in one go if possible, especially after a reformat, instead of installing old drivers off the CD and then having to update. Thanks everyone

    Then don't install the drivers on the cd. Download the latest, install them, don't reboot, run the cd and select Custom install and only install the parts you want, and uncheck the drivers. Or does that make too much sense?

  • Similar pages but editable regions are only available on one

    I have two published pages here:
    http://www.larrysproduce.com/vegetables.html
    http://www.larrysproduce.com/fruits.html
    Both use the same CSS.  ICE has allowed me to make the table area (containing the vegetables) editable on the vegetables page but the option (i.e. the dotted lines indicating 'available to designate as editable') do not appear on the fruits page.  Only the header div is a available to designate as editable on that page.
    Can anyone help?
    Thanks

    There are a MAP and an AREA tag inside the "fruits" page. InContext Editing does not have support for editing such tags.
    We recommend creating 2 Editable Regions for the fruits page, one for the content before the MAP tag, one for the content after the MAP tag.
    Or simply move the "mainContent" DIV tag end just before the MAP/H2 tag, which I'm not sure if it is really intended for your editors to edit.
    Hope this helps,
    Dan Popa

  • Is there a way to filter apps that are only available for your current version of ios

    I have the first generation iphone. It still works pefectly and I would like to give it to my 1yo son, so that he can play around with it. It has latest supported ios 3.1.3. I went to the apple store to find some kid friendly apps for the device, only to find out that almost ever app requires a version of ios higher than 3.1.3. I understand that this is the limitation of old hardware. I just wish that there was a way for me to only see apps that would still work on my device. Currently, I have to click on the app, then start the download, only to get a message that says that I need ios > 3.1.3. I can also imagine that there are a lot of people out there who don't know the ios limits per device. Wouldn't it be better if the message read, "this app requires ios 4.3 which is supported on iphone 3 or higher" or even simpler "this app is not supported on your device. It is supported on iphone 3 or better". But the ios filter would go a really long way.
    Thanks
    Richard

    you can leave feedback with apple at apple.com/feedback

  • How to find out XPath-Errors, that are only logged on the console

    Hi,
    I'm using the Java-API of XMLP Standalone Version 5.6.2. If my layout contains a german umlaut, like:
    <?for-each:Behälter_zeile?>
    <?BEFMTB_BEZEICHNUNG?>
    <?end for-each?>
    I get the following output in my application console when I call RTFProcessor.process() for this layout:
    [040609_111900450][][ERROR] [Line 118.183] Incorrect XPath: Behälter_zeile
    There is no exception thrown and the generated document seems to be correct.
    My question: How can I determine such an error in my application? I want to do at least some intelligent logging.
    Mirko

    Hi Thomas,
    According to your description, you want to have a role-specific default member for different roles. Right?
    In Analysis Services, when granting access to dimension, a connection will fail if a role restricts access to a default measure. As you mentioned, the best solution is specify a default member for each role. But for administrator role(full control),
    it can't set the default member. All tabs except General and Membership are disabled. And the system can determines the default member of current user automatically. It's not supported to get the default member in MDX either.
    However, SSAS has additive design for role security. So in this scenario, we just need to create another role for those members of administrator role and specify a default member for this role. SSAS will take that role-specific default member
    for these users. And it will not effect the administration permission for them.
    Reference:
    Default members, MDX Scripts, Security, KPIs and Perspectives
    The Additive Design of SSAS Role Security
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou
    TechNet Community Support

  • I want to buy ebooks from iBooks store, not on Amazon. But I can't because it says that the ebooks are only available on the US. Help  

    By the way, I live in the Philippines. Please help!

    You just have to use whatever store has the book you want, that is how it works at present.  Try Kindle, Nook, Kobo, Googlebooks, Sony if something is not available to you in the iBookstore.

  • I can't download apps that are only  available in  us iTunes Store. Please help

    Hello. I have an ipad. I live outside the United States. I want to download a game called "real steel" but when I try to download it, it says "this item is not availble In your store" help please. How can I download it?

    Content may be unavailable because of licensing rights, copyright issues, government restrictions....all out of Apple's control. If you know that the developer has other content available in your country, contact them and let them know that you would like to have the game available in your App Store. It can't hurt to let them know.

  • Error about Source Level only if 5.0?  I'm using Java 1.6?  Maps

    Hello everyone. I was just trying to run some simple Source Code from my book here:
    package mapa;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Set;
    public class MapTest
         Map<String, String> phonebook = new HashMap<String, String>();
        // constructor
        public example2(String n[], String nums[]) {
           for(int i=0; i< n.length; i++)
               phonebook.put( n, nums[i] );
    public static void main(String[] args) {
    // data
    String [] names = { "Lefty", "Guarav", "Wong", "Rupamay" };
    String [] extns = { "4873", "4810", "3769", "0" };
    // get an instance of this class
    example2 ex = new example2( names, extns );
    // dump out the map
    System.out.println("map: " + ex.phonebook);
    // get the mappings
    Set<Map.Entry<String,String>> s = ex.phonebook.entrySet();
    // iterate over the mappings
    // for (Iterator i = s.iterator(); i.hasNext(); ) {
    for (Map.Entry me : s) {
    Object ok = me.getKey();
    Object ov = me.getValue();
    System.out.print("key=" + ok );
    System.out.println(", value=" + ov );
    and i'm getting the following errors when I run it in Eclipse:
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         example2 cannot be resolved to a type
         example2 cannot be resolved to a type
         Syntax error, parameterized types are only available if source level is 5.0
         The type Map.Entry is not generic; it cannot be parameterized with arguments <String, String>
         Syntax error, 'for each' statements are only available if source level is 5.0
         at mapa.MapTest.main(MapTest.java:24)Line 24 is:
      example2 ex = new example2( names, extns );I've compiled things with Eclipse before such as Networking programs and they worked fine, not sure whats wrong with this example.
    Thanks!

    Oops it looks like on that line they are using the Class itself, and they had it renamed to Example2 not MapTest. I changed the code to the following but still getting errros:
    package mapa;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Set;
    public class MapTest
         Map<String, String> phonebook = new HashMap<String, String>();
        // constructor
        public example2(String n[], String nums[]) {
           for(int i=0; i< n.length; i++)
               phonebook.put( n, nums[i] );
    public static void main(String[] args) {
    // data
    String [] names = { "Lefty", "Guarav", "Wong", "Rupamay" };
    String [] extns = { "4873", "4810", "3769", "0" };
    // get an instance of this class
    MapTest ex = new MapTest( names, extns );
    // dump out the map
    System.out.println("map: " + ex.phonebook);
    // get the mappings
    Set<Map.Entry<String,String>> s = ex.phonebook.entrySet();
    // iterate over the mappings
    // for (Iterator i = s.iterator(); i.hasNext(); ) {
    for (Map.Entry me : s) {
    Object ok = me.getKey();
    Object ov = me.getValue();
    System.out.print("key=" + ok );
    System.out.println(", value=" + ov );
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         The constructor MapTest(String[], String[]) is undefined
         ex.phonebook cannot be resolved or is not a field
         Syntax error, parameterized types are only available if source level is 5.0
         The type Map.Entry is not generic; it cannot be parameterized with arguments <String, String>
         ex.phonebook cannot be resolved or is not a field
         Syntax error, 'for each' statements are only available if source level is 5.0
         at mapa.MapTest.main(MapTest.java:24)

  • Why are some TV seasons only available for purchase "by episode only"???

    Hello,
    I'm just wonderng why certain seasons of certain shows (most often the first season) are only available for purchase by episode and not the whole season...????

    That content owner in Canada is currently Superchannel.  So you can either pay them $19 per month, or else you can boycott them until they do release SOA to iTunes.  I have opted for the latter.

Maybe you are looking for

  • How do i sync pages from iMac to iPad. I am new to mac and this is confusing

    how do I sync between IMAC and IPAD. I just downloaded pages into my IMAC and I can not figure out how to download it onto my ipad2. I do not want to download the product again for $10. i was told that this is handled in itunes but i can not figure i

  • How to Extract  data from a transaction..

    Hi All There are some transactions and report programs which are used daily to produce some results and the requirement is to extract that data into BW so how can we extract information from a transactions and programs Any help will be really appreci

  • Scaling a bmp image

    I need to scale a bmp image in the x-y directions independently of each other.  The zoom function doesn't work for my application because it locks the aspect ratio at 1:1.  I would like to import a bmp and have it scale automaticly to the size of a p

  • Quick way to recover purchased apps?

    I just did an iPad sync that I very much regret having done.  (https://discussions.apple.com/message/17804531#17804531) In order to get one lousy PDF from my computer to my iPad, I both burned 45 minutes and lost about 15 apps.  Half the apps were fr

  • Intermedia/XML Support...PLEASE ORANET

    Is there someone out there who can provide some real world examples of performing this simple task.... I have an XML document, I want to feed it into 8i and search by content using the tags... Remember my XML document has over 100 tags, do I have to