Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Import util.Hashmap Map problem

Reply
Thread Tools

Import util.Hashmap Map problem

 
 
Sharad
Guest
Posts: n/a
 
      09-27-2006
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

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      09-27-2006
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

 
Reply With Quote
 
 
 
 
Doug Pardee
Guest
Posts: n/a
 
      09-27-2006
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.

 
Reply With Quote
 
Sharad
Guest
Posts: n/a
 
      09-27-2006
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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem(s) with import from parent dir: "from ../brave.py import sir_robin" per9000 Python 7 02-27-2006 06:36 PM
to use import java.lang.* or import java.lang.Math or none at all? JPractitioner Java 13 02-24-2006 08:48 PM
XML Schema question - does "import" import elements? Vitali Gontsharuk XML 2 08-25-2005 07:33 PM
Problem with import "from omniORB import CORBA, PortableServer" Stefan Seefeld Python 3 04-11-2005 08:54 PM
IMPORT STATIC; Why is "import static" file scope? Why not class scope? Paul Opal Java 12 10-10-2004 11:01 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57