PDA

View Full Version : JAva templates in xcode 3.2




frustrated007
Oct 23, 2009, 08:17 PM
I am confused. From what I've read here and elsewhere, most of the project templates that were in xcode 2 are not in xcode 3. Still, you can use the Organizer to create some java applications, but you don't get an xcode project file -or do you get one and I just didn't find how?

The story is, I just got a new MacBookPro (yeah!:)) and I am importing all my stuff from my old MacBookPro. In particular I have a console Java application created in XCode 2; the project opens fine in Xcode 3 but it won't build. So I put my code in the Organizer generated java app and it works fine, but I would still like to get it the old way with the project file...



Watabou
Oct 23, 2009, 09:06 PM
My problem is similar. Do you get "build xml can't be found" error?

SRossi
Oct 24, 2009, 08:11 AM
Don't know if this will be help but found this (http://discussions.apple.com/message.jspa?messageID=10114321)

Stephen

frustrated007
Oct 25, 2009, 01:58 PM
Thanks Stephen, that sort of confirms what I found.
All the java stuff is gone in xcode 3.2 and that's odd as in the help of this same Xcode 3.2, Apple boasts how java is really totally integrated in the System...

My problem is similar. Do you get "build xml can't be found" error?
No I get something that starts with "Internal error occurred while creating dependency graph"

chown33
Oct 25, 2009, 02:57 PM
In particular I have a console Java application created in XCode 2; the project opens fine in Xcode 3 but it won't build. So I put my code in the Organizer generated java app and it works fine, but I would still like to get it the old way with the project file...

Depending on which Xcode 2 project template you originally used, the old way may not be possible.

Xcode 3.2 completely removed the 'jam' build system. Jam was the builtin Xcode build system since the beginning of time. Xcode 2 introduced a "native target" build system, but that can't build Java targets.

Xcode 2 also introduced Java project templates that used the Ant build system. So if your original Xcode 2 project was jam-based, then Xcode 3.2 can't build it at all. There should be an error message that mentions jam in the build results window. It may also give the bogus recommendation to convert it to a native target.

However, if the original Xcode 2 project was Ant-based, then Xcode 3.2 should be able to build it as-is. Ant requires a "build.xml" file, which it uses to tell it what and how to build. If that file is missing or deleted for some reason, then Ant can't build. If that happens, Ant should emit the "build.xml can't be found" error message.


If the Organizer project can't be built because build.xml is missing, then you'll have to restore build.xml. The simplest way I know to do that is to create a new Organizer Project from an appropriate template, then move your existing src folder over to the new project (use Finder). Don't delete build.xml in the new project.


Java beginners may find it easier to start writing code by ignoring Xcode 3.2 and using an IDE designed for beginners: BlueJ.

http://www.bluej.org/

There are other Java dev tools available. BlueJ is just one that others I've suggested it to found useful for getting started. Some people dislike it because it's not a pro-level IDE. Those people might be better served by a professional tool, rather than one oriented toward education.

frustrated007
Oct 25, 2009, 04:09 PM
Depending on which Xcode 2 project template you originally used, the old way may not be possible.

XCode 2.4.

Xcode 3.2 completely removed the 'jam' build system. Jam was the builtin Xcode build system since the beginning of time. Xcode 2 introduced a "native target" build system, but that can't build Java targets.

Xcode 2 also introduced Java project templates that used the Ant build system. So if your original Xcode 2 project was jam-based, then Xcode 3.2 can't build it at all. There should be an error message that mentions jam in the build results window. It may also give the bogus recommendation to convert it to a native target.

However, if the original Xcode 2 project was Ant-based, then Xcode 3.2 should be able to build it as-is. Ant requires a "build.xml" file, which it uses to tell it what and how to build. If that file is missing or deleted for some reason, then Ant can't build. If that happens, Ant should emit the "build.xml can't be found" error message.

Yes my Xcode 2 project has a build.xml file and actually is built using Ant in XCode 2. I saw the project configuration has a "custom build" instruction that specifies a particular path to Ant; this path happens to be not right in the Xcode 3.2 -or perhaps it is a difference in the system (I have XCode 2 installed on 10.4). So actually I deleted this "Custom build" thing and got the error mentioned above. I'm guessing that to get it the old way I just need to figure out what Custom Build instruction should be specified but after looking around a bit I didn't find an answer.


If the Organizer project can't be built because build.xml is missing, then you'll have to restore build.xml. The simplest way I know to do that is to create a new Organizer Project from an appropriate template, then move your existing src folder over to the new project (use Finder). Don't delete build.xml in the new project.

That's what I did, it works just fine.

Java beginners may find it easier to start writing code by ignoring Xcode 3.2 and using an IDE designed for beginners: BlueJ.

http://www.bluej.org/

There are other Java dev tools available. BlueJ is just one that others I've suggested it to found useful for getting started. Some people dislike it because it's not a pro-level IDE. Those people might be better served by a professional tool, rather than one oriented toward education.
Thanks for mentioning BlueJ, I'll have a look at it.

frustrated007
Oct 26, 2009, 11:02 AM
I'm guessing that to get it the old way I just need to figure out what Custom Build instruction should be specified but after looking around a bit I didn't find an answer.


I figured it out. I specified /usr/bin/ant as the Build Tool and it works.