Hi,
I have a java application that works on osx. The way it works is :
1.An xcode project is created with cocoa framework.
2.The jar is built and copied to the resources folder via the build phase.
3.In the main method of the xcode project I use
int (*jliLaunchFunctionPointer)() = dlsym(handle, "JLI_Launch");
to launch the application.
jliLaunchFunctionPointer(argvArrSize, argv2, / main argc, argc */
0, NULL, / java args */
0, NULL, / app classpath */
FULL_VERSION, / full version defined */
DOT_VERSION, / dot version defined */
"Name", / program name */
"launch name",/ launcher name */
FALSE, / JAVA_ARGS */
FALSE, / classpath wildcard*/
FALSE, / windows-only javaw */
0); / ergonomics class policy */
I have added the required values in the info.plist for the application such that my application gets launched when the url is fired.
However i cannot pass arguments in the url to the java application.
To do this I used the following code in CustomUrl.m file:
- (void)getUrl:(NSAppleEventDescriptor *)event
withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
// Get the URL
NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject]
stringValue];
NSLog(@" CUSTOM URL %@", urlStr);
}
- (void)registerForUrl:()Null {
NSLog(@" Register for url");
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
}
I call this from the main mehtod before launching my java application.
However I do not get a callback when the url is fired.
I am quite new to objective c so I am not aware if there are other ways to do it.
I have also tried out com.apple.eawt.OpenURIHandler, but this is now deprecated I guess.
Can someone please suggest ways to get this thing working.
Thanks.