• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Porting application in JDK1.1 to JDK1.3

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any suggestions/ideas for porting an application based on jdk1.1 to jdk1.3?
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried it? Although a lot of stuff has been deprecated in later versions, I'm not aware of much which has actually been removed, so most earlier code should just work.
What kind of problems are you getting?
 
Ban Bala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Currently, I am looking at the (Visual age generated code) "cannot be resolved" at the import com.sun.java.swing.Jpanel kind of errors. I am trying to compile with eclipse.
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, yes. I forgot about Swing. All the Swing classes have been moved from the unofficial com.sun.java.swing package to javax.swing.
You should get pretty close by doing a global replace from "com.sun.java.swing" to "javax.swing" across all your source files.
 
Ban Bala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frank.
I am getting an error on clone() method. "The method clone() from the type java.lang.Object is not visible." I am looking for solving this with minimum changes. Any help!
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you post the relevant code where you are getting this error?
 
Ban Bala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
myInstance = (NameComponent) nc.clone();

Error:
"The method clone() from the type java.lang.Object is not visible."

Likely Solution:
The java.lang.Object class contains a clone() method that returns a bitwise copy of the current object.
You may want to override clone() to make it public instead of protected. In this case, you can simply fall back on the superclass implementation. For example
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
My Problem:
NameComponent is in a third party jar file and changing it is not very attractive.
 
Frank Carver
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One trick in this case is to not use the third-party class sirectly, but instead subclass it. Your new subclass should just have the "clone" method as shown in the message. Then in any of your code where you need to call "clone", make sure that you call it on the subclass ojcet instead.
If you actually need to "clone" a third party object created inside some black-box library from a class which did not have public a "clone" method then you are probably out of luck. If the object is Serializable, you may be able to serialize and deserialize it to achieve the same end result, but that's pretty horible!
 
Ban Bala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frank. The problem of clone was solved by adding another jar in front.
Just to share with everyone:
Main changes due to JDK1.3 were:
1. Replaced javax.swing.plaf.basic.BasicMarginBorder with BasicBorders.MarginBorder
2. Replace appendDescription with addMessageComponents
3. Replaced com.sun.java.swing with import javax.swing
4. Replaced BasicListCellRenderer with DefaultListCellRenderer
5. Replaced javax.swing.plaf.metal.Flush3DBorder() with javax.swing.plaf.metal.MetalBorders.Flush3Dborder
6. Replaced javax.swing.preview.JfileChooser with javax.swing.JfileChooser
7. Replaced com.sun.java.swing.BasicFieldBorder with javax.swing.plaf.basic.BasicBorders.FieldBorder(Color.gray,
8. Color.darkGray, Color.blue, Color.blue)
9. Replaced import javax.util.collections.Comparable; with import java.lang.Comparable;
10. Replaced import javax.util.collections.Iterator; with import java.util.Iterator;
11. Replaced import javax.util.collections.TreeSet; with import java.util.TreeSet;
12. Replaced import javax.swing.plaf.basic.BasicTreeCellRenderer; with import javax.swing.tree.DefaultTreeCellRenderer;
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic