Using <java.lang.Class>:forName with define-simple-class
alex mitchell
lexaay@gmail.com
Fri May 7 08:32:00 GMT 2010
I'm trying to get a kawa-based application to be aware of MacOS application
events such as Apple-Q, and would like to avoid having to change my source
code when compiling on other platforms. I've got this working except for one
problem. When I define a class implementing ApplicationAdapter as follows:
(define-simple-class <my-application-adapter>
(<com.apple.eawt.ApplicationAdapter>)
...)
everything works fine on a Mac, but I'm assuming I won't be able to compile
this on non-Mac platforms, since com.apple.eawt.ApplicationAdapter won't be
there. Instead, I've tried this:
(define-simple-class <my-application-adapter> ((<java.lang.Class>:forName
"com.apple.eawt.ApplicationAdapter"))
...)
However, I get an "invalid super type" compile-time error.
I would like to be able to implement com.apple.eawt.ApplicationAdapter at
runtime. For now I'm commenting out the line where the file containing this
code is required when I compile, but this is not ideal.
Anyone have any suggestions as to how to do this?
thanks,
Alex
More information about the Kawa
mailing list