Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleEvents from a multiplatform Java app?



From: Alexander Lohse <email@hidden>  
 
> I was searching a lot through the net , but I could not find any hint 
> how to be able to fire applevents or applescripts from a java 
> application. 

I have some JNIDirect, like JDirect used to be, that shows some of this. Mostly Carbon a little Cocoa. 

> All I found was something like this: 

Looks fine

> I tried to embedd this in my Crossplattform Application, so I wrote 
> subs for the imports. 
> But no result. 

Assuming you meant 'stubs' this should work. The only catch I can think of is you would have to provide the stubs with dummy implementations of the constructors and methods used in the code.

> I can go very well with code like: 
> if (System.getProperty("mrj.version") == null) { ... } 
> or reflection-method-calls 

mrj.version I thought is sort of deprecated otherwise this should work all right as well. This is what I usually do for platform specific code except using the os.name property.
I also have a class (GestaltReflection formerly part of GestaltClasses) that is supposed to make the reflection somewhat easier. A lot of overloaded 'newinstance' and 'invoke' methods not provided by core java. Still I had to change one or two instances of this to recently get my application working again on Windows. Just yesterday I had to figure out that a properties file wasn't loading because I was giving it hardcoded file separators. It's easy enough for small platform specific matters to render the application unusable elsewhere. 

More a concern is that the code I was looking at yesterday made some version specific use of 'assert'. Old javac that my application still uses didn't seem to care for this so I switched to modern javac. Seems to be working ok for Windows but modern javac seemed to keep giving me numerous and difficult to back out problems when I tried it OS X so I kept sticking to the deprecated older version. Even if Windows doesn't have problems it's hard to say how things will look when I get back to the Mac.

I still have yet to find the SourceForge project that is bringing AppleScript to Windows. That would resolve that issue without your code needing to change.

Mike Hall    mikehall at spacestar dot net
http://www.spacestar.net/users/mikehall 




But I would not like to maintain platformspecific source code. 

Regards, 

Alex 

_______________________________________________ 
Do not post admin requests to the list. They will be ignored. 
Java-dev mailing list      (email@hidden) 
Help/Unsubscribe/Update your Subscription: 
http://lists.apple.com/mailman/options/java-dev/email@hidden 

This email sent to email@hidden 
 
 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >AppleEvents from a multiplatform Java app? (From: Alexander Lohse <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.