openjdk 9 in ios - any sample xcode project or any sample using JavaLauncher interface?
gary.adams at oracle.com
gary.adams at oracle.com
Sat Mar 5 00:02:47 UTC 2016
Until we get tools and sample projects pushed, it's worth noting the
minimal set
of artifacts needed for a jdk9 ios xcode project.
I usually make a directory to hold the ide only pieces only needed at
build time
mkdir java/a
mv `find jre/lib -name '*.a'` java/a
mv `find jre/lib -name '*.symbols'` java/a
(cd java/a; cat lib{java,jvm,jimage,net,nio,verify,zip}.symbols >
exported.symbols)
With the JavaLauncher.framework and the java/a directory you have all
key elements.
You can use the Build Phases settings to identify libraries and
frameworks and the
combined symbols list to force the objects to be pulled into your
executable. You could also
set the search path for libraries and simply add the libs as extra
linker flags.
e.g. -ljm -ljava -ljimage -lnet -lnio -lverify -lzip -lstdc++ -lz -lfdlibm
The unused bin/unpack200 should not have been built.
On 3/4/16 5:46 PM, Bob Vandette wrote:
> Hi Grigory,
>
> We have been pretty focused on just keeping up with the evolving JDK 9 sources
> and haven’t yet had enough time to devote to getting samples into the repository
> or document the project structure requirements.
>
> In general we require the same JRE structure that you’d see on non Mobile platforms
> to be maintained with one exception. All static libraries are only used when the project is
> being built and should not be marked for inclusion in the application package.
>
> Here’s an old Xcode project which I published before we integrated the JavaLauncher into
> the mobile repo. It will at least give you an idea how the Java binaries are packaged.
>
> http://cr.openjdk.java.net/~bobv/mobile/j1/xcode/RunJava.tar.gz
>
> If you’d like to convert this to use the JavaLauncher, you should take a look at JavaLauncher.h
> which described the JavaLauncher Framework interface.
>
> Here’s an example of how it is used:
>
> static void javaLauncherCallback(const char *exception_msg, int error_code, void *app_data)
> {
> NSLog(@"HelloWorld::javaLauncherCallback: Received exception.");
> NSLog(@"HelloWorld::javaLauncherCallback: Exception msg: %@.",
> [NSString stringWithUTF8String: exception_msg]);
> }
>
> static JavaArgs *java_args = NULL;
>
> @implementation HelloWorld
>
> +(void)initialize
> {
> if (java_args == NULL) {
> java_args = [[[JavaArgs alloc] init] retain];
> java_args.callback = javaLauncherCallback;
> }
> }
> +(void)createJavaVM
> {
> [JavaLauncher createJavaVM:java_args];
> }
> +(void)callJava
> {
> [JavaLauncher performSelectorInBackground:@selector(callJava:)
> withObject:java_args];
> }
>
> @end
>
> Let me know if you have any questions.
> Bob.
>
>
>> On Mar 4, 2016, at 4:57 PM, Grigory Ptashko <grigory.ptashko at gmail.com> wrote:
>>
>> Hello.
>>
>> Does anyone have any examples on how to use java from jdk9 on ios?
>> I’ve built the jdk and jre, found the Java Launcher objective-c interface.
>> But I cannot understand how can I use them in the xcode project.
>>
>> I can add the JavaLauncher.framework to my project and include JavaLauncher.h.
>> But what libraries should I link my target against?
>>
>> Here’s the jre tree. What am I supposed to do with all these files in terms of adding them to
>> my xcode project? All the *.a and *.jimage files?
>>
>> ├── bin
>> │ └── unpack200
>> ├── conf
>> │ ├── logging.properties
>> │ ├── management
>> │ │ ├── jmxremote.access
>> │ │ ├── jmxremote.password.template
>> │ │ ├── management.properties
>> │ │ └── snmp.acl.template
>> │ ├── net.properties
>> │ ├── security
>> │ │ ├── java.policy
>> │ │ └── java.security
>> │ └── sound.properties
>> ├── lib
>> │ ├── amd64
>> │ │ ├── jli
>> │ │ │ ├── libjli.a
>> │ │ │ └── libjli.symbols
>> │ │ ├── jvm.cfg
>> │ │ ├── libfreetype.a.6
>> │ │ ├── libj2gss.a
>> │ │ ├── libj2gss.symbols
>> │ │ ├── libj2pcsc.a
>> │ │ ├── libj2pcsc.symbols
>> │ │ ├── libj2pkcs11.a
>> │ │ ├── libj2pkcs11.symbols
>> │ │ ├── libjaas_unix.a
>> │ │ ├── libjaas_unix.symbols
>> │ │ ├── libjava.a
>> │ │ ├── libjava.symbols
>> │ │ ├── libjimage.a
>> │ │ ├── libjimage.symbols
>> │ │ ├── libmanagement.a
>> │ │ ├── libmanagement.symbols
>> │ │ ├── libnet.a
>> │ │ ├── libnet.symbols
>> │ │ ├── libnio.a
>> │ │ ├── libnio.symbols
>> │ │ ├── libsunec.a
>> │ │ ├── libsunec.symbols
>> │ │ ├── libunpack.a
>> │ │ ├── libunpack.symbols
>> │ │ ├── libverify.a
>> │ │ ├── libverify.symbols
>> │ │ ├── libzip.a
>> │ │ ├── libzip.symbols
>> │ │ └── minimal
>> │ │ ├── Xusage.txt
>> │ │ ├── libjvm.a
>> │ │ └── libjvm.symbols
>> │ ├── classlist
>> │ ├── java.base.symbols
>> │ ├── modules
>> │ │ ├── appmodules.jimage
>> │ │ ├── bootmodules.jimage
>> │ │ └── extmodules.jimage
>> │ ├── psfont.properties.ja
>> │ ├── psfontj2d.properties
>> │ ├── security
>> │ │ ├── US_export_policy.jar
>> │ │ ├── blacklisted.certs
>> │ │ ├── cacerts
>> │ │ └── local_policy.jar
>> │ └── tzdb.dat
>>
>> Please, can anyone shed some light on it?
>>
>> Thank you.
>>
>> --
>> Best regards,
>> Grigory Ptashko
>>
>> +7 (916) 1489766
>> grigory.ptashko at gmail.com
>> facebook.com/GrigoryPtashko
>>
More information about the mobile-dev
mailing list