• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Need to write ArrayList class & Iterator interface in jdk1.1.8

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Cindy Glass,
Thanks for the idea...Could you tell me the procedure to borrow the class files?
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could also download the Collections addin for jdk 1.1 http://java.sun.com/products/javabeans/infobus/#COLLECTIONS
------------------
I Hope This Helps
Carl Trusiak, SCJP2
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Carl Trusiak,
Could you please provide more info (step by step), how the Infobus would help me?
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that the best information available on setting up your java environment is found at Java Tutorial "First Cup of Coffee"
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Carl Trusiak,
Thank you very much. I compiled all the programs successfully.
 
Uma Viswanathan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)


Take a look at http://java.sun.com/docs/books/tutorial/collections/problems/index.html.
Heli

[This message has been edited by Helmut Lerch (edited October 02, 2001).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic