2008年6月25日 星期三

build java project from eclipse in xcode

prepare:
change Java template in Xcode
edit  /Developer/Library/Xcode/Project Templates/Java/Java Applicationex/build.xml
       source="1.5"  target="1.5"

(1)check out project "Test" from cvs
(2)create the Java project named "Test"
(3)now xcode create build.xml to compile your Java project 

include external jars
place jars in   Test/lib/

set main function:
in Info.plist,  set value = packageName.className  for key = MainClass
in Manifest,  set  Main-Class: packageName.MainClass

set image files:
place them in Test/bin

set VMOptions
in info.plist,  set  "-Xmx512m"  for key  "VMOptions"

set class path for app:
In Info.plist, set the value of  ClassPath
ex:

<key>ClassPath</key>

<array>

<string>$JAVAROOT/test1.jar</string>

<string>$JAVAROOT/test2.jar</string>

</array>


not including other jars when creating jar
comment  zipgroupfileset refid="lib.jars"

when the resource is the same location as execution file, how to set resource:
1. if execution file is jar(in jars/) , put resource in jars/ and use "java -jar" to run program
2. if execution file is App(in dist/), put resource in dist/  and run from xcode
3. place them in the bin/packageName/  


沒有留言: