This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Java in General and the fly likes Porting application in JDK1.1 to JDK1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Porting application in JDK1.1 to JDK1.3" Watch "Porting application in JDK1.1 to JDK1.3" New topic
Author

Porting application in JDK1.1 to JDK1.3

Ban Bala
Greenhorn

Joined: Jul 02, 2002
Posts: 14
Any suggestions/ideas for porting an application based on jdk1.1 to jdk1.3?
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Ban Bala
Greenhorn

Joined: Jul 02, 2002
Posts: 14
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

Joined: Jan 07, 1999
Posts: 6920
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

Joined: Jul 02, 2002
Posts: 14
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!
Aj Manch
Ranch Hand

Joined: May 07, 2001
Posts: 50
Could you post the relevant code where you are getting this error?
Ban Bala
Greenhorn

Joined: Jul 02, 2002
Posts: 14
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

Joined: Jan 07, 1999
Posts: 6920
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

Joined: Jul 02, 2002
Posts: 14
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;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Porting application in JDK1.1 to JDK1.3
 
Similar Threads
Class.forName() error
headache of rmiregistry
JDK1.3 and JDK1.1
Jdk1.3 on linux
Property() and Class.forName() error in jdk1.1/1.3