Import util.Hashmap Map problem

Discussion in 'Java' started by Sharad, Sep 27, 2006.

  1. Sharad

    Sharad Guest

    Hi There....

    I'm running into these import problems....
    I'm trying to import the java.util.Map and java.util.HashMap Class on a

    IBM AIX server running java 1.4.2.


    Could anyone please help me in identifying what is that I am doing
    wrong....
    I have core.jar that has these files in the Lib dir...but still I get
    the error...notably it says it is Wrong version 48 expecting 45....


    I have no idea of this error could b....


    Appreciate your response


    /u/sharadch> $CLASSPATH
    ksh:
    /usr/java14/jre/lib/core.jar:/adw/adwinsp1/sqllib/java/db2java.zip:/adw/adw­insp1/sqllib/java/db2jcc.jar:/adw/adwinsp1/sqllib/java/sqlj.zip:/adw/adwins­p1/sqllib/function:/adw/adwinsp1/sqllib/java/db2jcc_license_cisuz.jar:/adw/­adwinsp1/sqllib/java/db2jcc_license_cu.jar:.:

    not found.
    /u/sharadch> $PATH
    ksh:
    /usr/java14/jre/bin:/opt/oracle/product/9.2.0/bin:/usr/bin:/usr/ucb:/etc:/u­sr/dt/bin:/usr/bin:/usr/ucb:/etc:/usr/dt/bin:/usr/bin:/usr/ucb:/etc:/usr/dt­/bin:/usr/bin:/usr/ucb:/etc:/usr/dt/bin:/usr/bin:/usr/ucb:/etc:/usr/dt/bin:­/opt/openlink5/bin:/opt/openlink5/samples/ODBC:/usr/bin:/etc:/usr/sbin:/usr­/ucb:/usr/bin/X11:/sbin:/usr/java130/jre/bin:/usr/java130/bin:/usr/local/bi­n:/u/sharadch/bin:/opt/sas:/usr/local/bin:/opt/ks/bin:/opt/openlink5/bin:/o­pt/datamart/utilities:/usr/atria/bin:/adw/adwinsp1/sqllib/bin:/adw/adwinsp1­/sqllib/adm:/adw/adwinsp1/sqllib/misc:/usr/bin:/etc:/usr/sbin:/usr/ucb:/u/s­haradch/bin:/usr/bin/X11:/sbin:

    not found.
    /u/sharadch> cat HelloWorld.java
    import java.util.Map;
    import java.util.HashMap;


    class HelloWorld {
    public static void main(String args[]) {


    System.out.print("Java Works !!!! ");


    }


    }/u/sharadch> javac HelloWorld.java


    error: Invalid class file format:
    /usr/java14/jre/lib/core.jar(java/util/Map.class), wrong version: 48,
    expected 45
    HelloWorld.java:1: Class java.util.Map not found in import.
    import java.util.Map;
    ^
    error: Invalid class file format:
    /usr/java14/jre/lib/core.jar(java/util/HashMap.class), wrong version:
    48, expected 45
    HelloWorld.java:2: Class java.util.HashMap not found in import.
    import java.util.HashMap;
    ^
    error: Invalid class file format:
    /usr/java14/jre/lib/core.jar(java/lang/Object.class), wrong version:
    48, expected 45
    HelloWorld.java:4: Superclass java.lang.Object of class HelloWorld not
    found.
    class HelloWorld {
    ^
    6 errors
     
    Sharad, Sep 27, 2006
    #1
    1. Advertising

  2. Can you tell us output of following commands:

    1.$ which java

    2. $ which javac

    3. $ java -version

    4. $ javac -version

    Looks like what you have is a version mismatch between javac and the
    jar files in the lib.

    -cheers,
    Manish
     
    Manish Pandit, Sep 27, 2006
    #2
    1. Advertising

  3. Sharad

    Doug Pardee Guest

    You're compiling with 1.3 but using 1.4 libraries.

    In your $PATH you don't have /usr/java14/bin - you only have
    /usr/java130/bin in there.

    The Java compiler is not part of the JRE, it's part of the SDK. You can
    run "java" just fine because you have /usr/java14/jre/bin, but you
    can't run "javac" from that directory.

    Fix your PATH and you should be fine.
     
    Doug Pardee, Sep 27, 2006
    #3
  4. Sharad

    Sharad Guest

    Hi There,

    Thanks All for your valuable suggestions.
    I will discuss with the IT Admin folks and get it fixed asap...


    Doug Pardee wrote:
    > You're compiling with 1.3 but using 1.4 libraries.
    >
    > In your $PATH you don't have /usr/java14/bin - you only have
    > /usr/java130/bin in there.
    >
    > The Java compiler is not part of the JRE, it's part of the SDK. You can
    > run "java" just fine because you have /usr/java14/jre/bin, but you
    > can't run "javac" from that directory.
    >
    > Fix your PATH and you should be fine.
     
    Sharad, Sep 27, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vivienne wykes
    Replies:
    1
    Views:
    508
    Christophe Vanfleteren
    Apr 6, 2004
  2. Vince Darley
    Replies:
    4
    Views:
    4,437
    emilchacko
    Mar 2, 2010
  3. www
    Replies:
    30
    Views:
    3,013
    Adam Maass
    Oct 23, 2007
  4. Rakesh
    Replies:
    10
    Views:
    12,185
    Mike Schilling
    Apr 8, 2008
  5. Andreas Leitgeb

    Question about HashMap and Map.Entry ...

    Andreas Leitgeb, Aug 30, 2012, in forum: Java
    Replies:
    15
    Views:
    700
    Robert Klemme
    Sep 1, 2012
Loading...

Share This Page