Hai I have written a java program in Windows platform. If i am going to write the same program using java in Mac OS . Is we need to change any thing in the program to make it comapatible with Mac OS.
For eg., If my program in windows is going to refer the windows registry. But in Mac OS there is no concept of registry . How to make make it compatible for both OS.
posted 10 years ago
If you use platform specific functionalilty, of which the Windows Registry is definately one, then you simply cannot use the the functionality "as is".
What you will have to do is abstract away the notion of the underlying mechanism. One way is to have your code talk to either an interface/abstract definition of the functionality that you want. Your other layers of code do not (should not) care about the underlying implementation. Then you can strategise the concrete implementation specific for the platform, it will then be easily extensible should you move to other platforms.
If you don't know about design patterns, you may wish to brush up on the famous patterns (by the "gang-of-four") to gain a better understanding of the mechanisms used and how you can apply them to your problem. Such things as these provide the logical solutions for such problems.