It turns out that printf was not in Java until Java 1.5 or so. You can use the command java -version to see what version you have on your system.
$ java -version java version "1.5.0_16" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284) Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
Apple has taken the conservative approach in Xcode and set the default library to Java 2 (1.2). It would be necessary to change my project to use the Java 1.5 library. This is easy. Just location the Build.xml in your project and find the target node (Project > target > javac) of the XML file. I found it about the 29th line.
<javac deprecation="on" srcdir="${src}" destdir="${bin}" source="1.3" target="1.2" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> </javac>
I edited this file right in Xcode but you can use any text or XML editor. I changed the source and target to version “1.5”.
<javac deprecation="on" srcdir="${src}" destdir="${bin}" source="1.5" target="1.5" includeAntRuntime="no" classpathref="lib.path" debug="${compile.debug}"> </javac>
This worked and I was able to get my project completed. I then needed to work on another project and had to repeat the process above. It occurred to me that there must be some way to fix this in a more permanent manner. As it turns out, Xcode has a very robust templating system. I found the Project Templates folder and the build.xml inside. I was able to make my changes to this file. Now every new project has these default settings.
/Developer/Library/Xcode/Project Templates/Java/Java Tool/build.xml
This Build.xml gets overridden if you reinstall Xcode.
Thx. This post really helped me.
In the next version of Xcode, Java development has been deprecated. You will still be able to compile your Java projects but the templates are gone for creating new projects. The message from Apple is clear to Java Developers: go away. The underlying Cocoa Bridge is gone that allowed Java to talk to Cocoa apps. This was what allowed WebObjects to make the transition from Cocoa to Java back in 1999. The choice for Java development is clear: Eclipse.
Please support your argument.
I have used Eclipse as both a PHP IDE and as a WebObject/Java IDE. In both cases I found it to be extremely flexible and robust. I have not found another IDE that works as well for me. In the case of WebObject the architecture has allowed a community to spring up to fill the void left by Apple with the WOLips project.
The Java language System library has a couple of functions for this purpose, print and println. Another approach is a feature of the C language in the form of a function “printf” that affords some easy formating options. When I tried to use printf I got the error message “cannot find symbol”. This took me aback.
erreauk
In Objective-C all strings are NSString Objects. In order to use the C functions, you would have to convert the NSString back into a C String. Fortunately there is a call for that.
In the next version of Xcode, Java development has been deprecated. You will still be able to compile your Java projects but the templates are gone for creating new projects. The message from Apple is clear to Java Developers: go away. The underlying Cocoa Bridge is gone that allowed Java to talk to Cocoa apps. This was what allowed WebObjects to make the transition from Cocoa to Java back in 1999. The choice for Java development is clear: Eclipse.
boediger
It seems to me that there is a Java language version flag which is set somewhere to 1.3. Presumably I want to set it to 1.6. However, I don’t see where to set this.
Excellent. Thanks for the knowledge. I found another good articles about java manual at pdfph[dot]com