Re: Program compiles, but does not run
Re: Program compiles, but does not run
- Subject: Re: Program compiles, but does not run
- From: Brigit Ananya <email@hidden>
- Date: Sat, 10 Jan 2009 16:13:56 -0800
Hi,
I am using Mac OS X 10.5.6 and XCode 3.0.
Well, Java programs are not completely portable. Certain
things have to be programmed differently for the MAC,
such as the About and Quit menu have to be in a different
place and the Command key has to be used instead of
the Control key.
Yes, I think my XCode project is built by Ant. I am not
using JNI libraries.
I am presently not using bouncycastle or any external .jar
files, so I don't know why it is complaining about
bouncycastle.
Here is a copy of my Info.plist file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST
1.0//EN"
"
http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>AnanyaCurves</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string>AnanyaCurves.icns</string>
<key>CFBundleIdentifier</key>
<string>com.AnanyaSystems.AnanyaCurves</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AnanyaCurves</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.0</string>
<key>Java</key>
<dict>
<key>ClassPath</key>
<string>$JAVAROOT/AnanyaCurves.jar</string>
<key>-Xmx512m</key>
<string>1.5+</string>
<key>ananyacurves.AnanyaCurves</key>
<string>Ananya
Systems</string>
<key>Properties</key>
<dict>
<key>apple.laf.useScreenMenuBar</key>
<string>true</string>
</dict>
</dict>
</dict>
</plist>
And here is a copy of my build.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project name="AnanyaCurves" default="install"
basedir=".">
<property name="src" location="src"/> <!--
java source folder -->
<property name="bin" location="bin"/> <!--
intermediate build products -->
<property name="jars" location="jars"/> <!--
jar files -->
<property name="lib" location="lib"/> <!--
local libraries linked against -->
<property name="dist" location="dist"/> <!--
build product location -->
<property name="resources"
location="resources"/> <!-- location of general java
resources -->
<property name="resources_macosx"
location="resources_macosx"/> <!-- location of Mac OS X
specific resources -->
<property name="compile.debug"
value="true"/>
<property name="apple.appstub"
location="/System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub"/>
<property name="application.macos"
location="${dist}/${ant.project.name}.app/Contents/MacOS"/>
<property name="application.macos.stub"
location="${application.macos}/${ant.project.name}"/>
<property name="application.resources"
location="${dist}/${ant.project.name}.app/Contents/Resources"/>
<property name="application.resources.java"
location="${dist}/${ant.project.name}.app/Contents/Resources/Java"/>
<!--
lib directory should contain any pre-built jar files needed to build the
project
AppleJavaExtensions.jar is included to allow the built jars to run
cross-platform if you depend on Apple eAWT or eIO classes.
See
http://developer.apple.com/samplecode/AppleJavaExtensions/index.html
for more information -->
<fileset id="lib.jars" dir="${lib}">
<include
name="**/*.jar"/>
</fileset>
<path
id="lib.path">
<fileset
refid="lib.jars"/>
</path>
<!--
Initialization target, for any prelimary setup needed to build
-->
<target
name="init" description="Preparation">
<mkdir
dir="${src}"/>
<mkdir
dir="${lib}"/>
</target>
<target
name="compile" depends="init"
description="Compile code">
<mkdir
dir="${bin}"/>
<javac
deprecation="on" srcdir="${src}"
destdir="${bin}"
source="1.5" target="1.5"
includeAntRuntime="no"
classpathref="lib.path"
debug="${compile.debug}">
</javac>
</target>
<target
name="jar" depends="compile" description="Build
jar">
<mkdir
dir="${jars}"/>
<jar
jarfile="${jars}/${ant.project.name}.jar"
basedir="${bin}"
manifest="${resources}/Manifest">
<!-- Inject
resources -->
<fileset
dir="${resources}/"
excludes="${resources}/Manifest"
/>
<!-- Merge
library jars into final jar file -->
<zipgroupfileset refid="lib.jars"/>
</jar>
</target>
<target
name="run-jar" depends="jar">
<java
jar="${jars}/${ant.project.name}.jar"
fork="true">
</java>
</target>
<target
name="package" depends="jar" description="Make a
double-clickable Mac OS X application">
<mkdir
dir="${dist}"/>
<mkdir
dir="${application.resources.java}"/>
<mkdir
dir="${application.macos}"/>
<!-- copy jars
-->
<copy
toDir="${application.resources.java}">
<fileset
dir="${jars}">
<include
name="*.jar"/>
</fileset>
</copy>
<!-- copy
application stub -->
<copy
file="${apple.appstub}"
toFile="${application.macos}/${ant.project.name}"/>
<!-- fix stub
permissions -->
<exec
executable="/bin/chmod">
<arg
line="755 '${application.macos.stub}'"/>
</exec>
<!-- copy and
configure Info.plist -->
<copy
file="${resources_macosx}/Info.plist"
toFile="${dist}/${ant.project.name}.app/Contents/Info.plist">
<filterset>
<filter
token="PROJECTNAMEASIDENTIFIER"
value="${ant.project.name}"/>
</filterset>
</copy>
<!-- copy the
icon -->
<copy
file="${resources_macosx}/${ant.project.name}.icns"
toDir="${application.resources}"/>
</target>
<!--
Install target, for building the actual product -->
<target
name="install" description="Create application"
depends="package">
</target>
<target name="run"
depends="install" description="Run the double-clickable
application">
<!-- Use the exec task to
open the application -->
<exec
dir="${dist}" executable="/usr/bin/open" os="Mac
OS X">
<arg line="${ant.project.name}.app"/>
</exec>
</target>
<target name="clean"
description="Remove build and dist directories">
<delete
dir="${bin}"/>
<delete
dir="${jars}"/>
<delete
dir="${dist}"/>
</target>
</project>
Thanks a lot for your time looking at these things!
Sincerely,
Brigit Ananya
![[]](/attachments/binKcGwp0Px8K.bin)
Ananya Systems
www.ananya.com
(408) 353-3000 business
(408) 313-3333 cellular
At 02:15 PM 1/9/2009, you wrote:
Brigit Ananya wrote:
I am new to XCode, and I am
trying to port a Java application from
the PC to the Mac. The program compiles, but does not
run.
Which version of Mac OS X? Xcode?
Is your Xcode project built by Ant? Does it have a build.xml
file?
In general, you don't need to recompile Java source to run it on
the
Mac. Jar-files are already cross-platform. You can just copy
the
jar file(s) and put them in an app-bundle with a suitable
Info.plist,
icon-file, etc. An exception to this is if you use JNI
libraries,
which do need to be compiled for Mac OS X.
When I try to run the ...app, I
get the message that the main class
is not specified, etc.
The message you posted suggests that the Info.plist is
incorrect.
Please post the XML contents of your Info.plist.
When I try to run the ...jar, I
do not get the message that the
main class is not specified, but I do get the message that there is
no Manifest section for bouncycastle, etc.
This suggests that your Manifest does not specify the signatures
for
one or more bouncycastle classes.
Why do I need
org/bouncycastle/asn1/DEREnumerated.class, and how
would I have to specify it in Manifest?
Are you directly using or referencing any bouncycastle classes?
If
so, exactly how are you including these classes in your build?
That
is, are you merging the bouncycastle jar into another jar, copying
a
jar-file into the app-bundle, or something else.
If you are not using or including any bouncycastle classes, even
indirectly, then you'll have to tell us what classes or jars you
are
including.
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list
(email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden