openjdk 9 in ios - any sample xcode project or any sample using JavaLauncher interface?

Bob Vandette bob.vandette at oracle.com
Sat Mar 5 21:13:15 UTC 2016


You should see a README.txt file contained in the RunJava tar bundle.  
This explains how to build and populate the sample Xcode project with the Java
runtime.

The runjava-setup.s <http://runjava-setup.sg/>h script copies the Java runtime artifacts (including the image files) to
the Xcode project.


Bob.

> On Mar 5, 2016, at 4:02 PM, Grigory Ptashko <grigory.ptashko at gmail.com> wrote:
> 
> In the RunJava project I did not find any links to *.jimage files.
> How can it be that they are not bundled?
> I can understand that this might somehow work in the simulator.
> But when building the app for a device where will java runtime take the classes from?
> 
>> On 5 марта 2016 г., at 23:46, Bob Vandette <bob.vandette at oracle.com> wrote:
>> 
>> The jimage files are the new JDK 9 Modular Runtime Image files for the Java runtime classes.
>> They replace the existing rt.jar and other runtime jar files.
>> 
>> https://bugs.openjdk.java.net/browse/JDK-8061971
>> 
>> The complete list of changes coming in JDK 9 can be found here:
>> 
>> http://openjdk.java.net/projects/jdk9/
>> 
>> Bob.
>> 
>>> On Mar 5, 2016, at 3:13 PM, Grigory Ptashko <grigory.ptashko at gmail.com> wrote:
>>> 
>>> Hello Bob.
>>> 
>>> 
>>> I see. That’s a very useful sample. Thank you very much.
>>> 
>>> But before I get started may I ask you what are the *.jimage files are?
>>> I see there are no rt.jar or tools.jar anymore.
>>> 
>>> I’m a long time jdk7 user so I’m not aware of the latest innovations in jdk..
>>> 
>>> Maybe some documentation links?
>>> 
>>> Thank you.
>>> 
>>>> On 5 марта 2016 г., at 1:46, Bob Vandette <bob.vandette at oracle.com> 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
>>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Best regards,
>>> Grigory Ptashko
>>> 
>>> +7 (916) 1489766
>>> grigory.ptashko at gmail.com
>>> facebook.com/GrigoryPtashko
>>> 
>> 
> 
> 
> --
> Best regards,
> Grigory Ptashko
> 
> +7 (916) 1489766
> grigory.ptashko at gmail.com
> facebook.com/GrigoryPtashko
> 



More information about the mobile-dev mailing list