PDA

View Full Version : Porting Code (e.g. Java)


Haggis McHaggis
2003.04.15, 06:04 AM
Hey, I'm new to Mac programming generally so pardon any stupidness and feel free to patronise as much as possible.

I was just wondering if porting windows based code (e.g. visual studio) can be done relatively easily? I realise it requires different libraries or whatever, but are there any standards that allow code to be moved from one platform to another?

I ask particularily as I'm coding in Java at the minute, using rubbish JCreator to compile it, and it would be great if the content could be copied and pasted to the nicer developer tool? Like open a Java project and include the Java files. Obviously it would steer clear of the interface builder but just give me the ability to work at home.

Any help appreciated.

OneSadCookie
2003.04.15, 06:23 AM
Java and most of its libraries are cross-platform. The same can't be said of many/most C++ libraries.

If you've got a Java app using Swing or the AWT for windowing, it should probably work just fine compiled by Project Builder (javac or jikes).

Steven
2003.04.15, 09:35 AM
You should be able to copy and paste the code, but make sure that you use the Java Tool template, as you don't want to use the Cocoa libraries.
Steven

Sta7ic
2003.04.15, 01:34 PM
Sort of a reiteration of OSC's post, Java use a virtual machine that doesn't *need* porting to other platforms once you find the way you're using to run the program -- being a student, that's usually with Terminal :P
All you really need to make Java code work is Project Builder and the Terminal. Then you're off.

C++ code ... you should realy "#if 0" your Library-specific lines and gradually introduce each library to see which ones are supported, but expect to rewrite a lot of the preprocessed-out code. Especially w/ VS C++, which I had the misfortune of using. Gaaaahhh.... MS needs to work on their compiler.
IMO, you haven't seen preprocessor spagetti until you try making a crossplat program with all variations in the same source files.

-"Sta7ic" Matt