Import util.Hashmap Map problem

S

Sharad

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
 
M

Manish Pandit

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
 
D

Doug Pardee

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.
 
S

Sharad

Hi There,

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top