This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Need to write ArrayList class & Iterator interface in jdk1.1.8
Uma Viswanathan
Ranch Hand
Joined: Jun 14, 2001
Posts: 126
posted
0
The code had already been written in jdk1.2. Now, we need to code for jdk1.1.8 bcoz HP10.2 supports only java1. Could someone give me idea to write the ArrayList and Iterator in jdk1.1.8? Thanx a lot...
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
You could "borrow" the class files from the new JDK and bundle them with your application, if you amend the package import statements. Otherwise you are just out of luck.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Uma Viswanathan
Ranch Hand
Joined: Jun 14, 2001
Posts: 126
posted
0
Hi Cindy Glass, Thanks for the idea...Could you tell me the procedure to borrow the class files?
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
If you open the rt.jar file with WinZip or FileLibrarian or whatever you use, just extract the class files that you want and put them with your class files. Be carefull though, because you need to research to take all the other classes that those 2 rely on to be sure that it works.
Uma Viswanathan
Ranch Hand
Joined: Jun 14, 2001
Posts: 126
posted
0
Hi Cindy Glass, Thanx for your reply... I tried using winzip. It created a zip file. Then if i try to extract that zip file, i could get only rt.jar file. Could you help me how to extract necessary class files from rt.jar "step by step"? Thank you very much...
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
The jar file IS a zip file already - don't add rt.jar to a new zip file. Instead OPEN the rt.jar using WinZip and it will show you the files that are compressed inside it. Then extract the classes that you want.
Hi Carl Trusiak, Could you please provide more info (step by step), how the Infobus would help me?
Uma Viswanathan
Ranch Hand
Joined: Jun 14, 2001
Posts: 126
posted
0
Hi Carl Trusiak, I had downlaoded collection1_1.zip from the site. Assume proj-name is the folder where all the project related .java files reside. Tried in three ways but all failed... 1) Copied and pasted collections1_1.zip under proj-name folder and set classpath as follows set CLASSPATH=.;c:\proj-name\collections1_1.zip This did not work 2) Extracted collections1_1.zip file and then copied and pasted collections.jar file under the folder proj-name. Then set the classpath as set CLASSPATH=.;c:\proj-name\collections.jar This also did not work 3) Copied and pasted collections1_1.zip under jdk1.1.8\lib and set the classpath as set CLASSPATH=.;c:\jdk1.1.8\lib\collections1_1.zip This also did not work Could you help how to use correctly? Thanks a lot...
Carl Trusiak
Sheriff
Joined: Jun 13, 2000
Posts: 3340
posted
0
Got to the link provided, read the readme. This is the complete API for Collections as found in jdk 1.2 any code you write in 1.1.8 that uses these calsses should be compatable with jdk 1.2
Uma Viswanathan
Ranch Hand
Joined: Jun 14, 2001
Posts: 126
posted
0
Gone to the link and read the readme file. That file is asking us to set collections.zip in the classpath...tried but could not succeed. Could you help me how to set the classpath correctly? [assuming that all .java files reside under proj-name folder]. Thanks a lot...
Hi Carl Trusiak, Thank you very much. I compiled all the programs successfully.
Uma Viswanathan
Ranch Hand
Joined: Jun 14, 2001
Posts: 126
posted
0
Hi Carl Trusiak, I tried to execute the program...but i am getting ClassCastException. Exception in thread "main" java.lang.ClassCastException: java.lang.String at com.sun.java.util.collections.TreeMap.compare(TreeMap.java:994) at com.sun.java.util.collections.TreeMap.put(TreeMap.java:444) at ServerConfigTbl.loadTable(ServerConfigTbl.java:135) at I2PServer.main(I2PServer.java:190) In the ServerConfigTbl.java, i tried to call put() of TreeMap class by passing two objects. I am getting the above error. Could you help me to resolve this? The same code was successfully compiled and executed in jdk1.2. After including this collections.zip file, it is successfully compiling in jdk1.1.8 but not executing...Shall we need to do casting? Could you provide me info? Thank you very much...
Helmut Lerch
Ranch Hand
Joined: Feb 11, 2001
Posts: 48
posted
0
Hi,
Originally posted by Uma Viswanathan: I tried to execute the program...but i am getting ClassCastException. Exception in thread "main" java.lang.ClassCastException: java.lang.String at com.sun.java.util.collections.TreeMap.compare(TreeMap.java:994)