Disabling AppNap from java
I think Im having problems with AppNap with my application, although it is difficult to understand when/if it is kicking in. 'The correct way to disable App Nap is to use the -[NSProcessInfo beginActivityWithOptions:reason:] and -[NSProcessInfo endActivity] APIs within your app via JNI, and only when your app is actually doing work.' - Mike Swingler Has anything been done to disable AppNap from java without having to use JNI Paul
Re: Disabling AppNap from java
JNA might be a simpler way to call native functions: https://github.com/twall/jna -- Eirik On 2/22/14, 8:51 AM, "Paul Taylor" wrote: >I think Im having problems with AppNap with my application, although it >is difficult to understand when/if it is kicking in. > >'The correct way to disable App Nap is to use the -[NSProcessInfo >beginActivityWithOptions:reason:] and -[NSProcessInfo endActivity] APIs >within your app via JNI, and only when your app is actually doing work.' >- Mike Swingler > >Has anything been done to disable AppNap from java without having to use >JNI > >Paul >
Re: Disabling AppNap from java
On 22/02/2014 20:43, Eirik Bakke wrote: JNA might be a simpler way to call native functions: https://github.com/twall/jna -- Eirik On 2/22/14, 8:51 AM, "Paul Taylor" wrote: I think Im having problems with AppNap with my application, although it is difficult to understand when/if it is kicking in. 'The correct way to disable App Nap is to use the -[NSProcessInfo beginActivityWithOptions:reason:] and -[NSProcessInfo endActivity] APIs within your app via JNI, and only when your app is actually doing work.' - Mike Swingler Has anything been done to disable AppNap from java without having to use JNI Paul I think JNA or its own is Wndows only isnt it, but there is something called rococoa. To be honest I was hoping someone else had encountered this particular problem with AppNap and had something to share. Paul
Re: Disabling AppNap from java
I've resisted posting this until now as it will probably just confuse the issue, but on this page you can find code which calls Objective C using both Rococoa and plain old JNI so you can compare and contrast. Of course the problem this is solving has nothing to do with AppNap and so it might be more distracting than anything else: http://pixel.recoil.org/code/rococoa/ Unfortunately like most things this is a matter of experience. Having done this before I could probably knock something up in a couple of hours that would meet your needs. But if it's your first time it'll be trickier for you. > On Feb 22, 2014, at 1:49 PM, Paul Taylor wrote: > >> On 22/02/2014 20:43, Eirik Bakke wrote: >> JNA might be a simpler way to call native functions: >> https://github.com/twall/jna >> >> -- Eirik >> >>> On 2/22/14, 8:51 AM, "Paul Taylor" wrote: >>> >>> I think Im having problems with AppNap with my application, although it >>> is difficult to understand when/if it is kicking in. >>> >>> 'The correct way to disable App Nap is to use the -[NSProcessInfo >>> beginActivityWithOptions:reason:] and -[NSProcessInfo endActivity] APIs >>> within your app via JNI, and only when your app is actually doing work.' >>> - Mike Swingler >>> >>> Has anything been done to disable AppNap from java without having to use >>> JNI >>> >>> Paul > I think JNA or its own is Wndows only isnt it, but there is something called > rococoa. > To be honest I was hoping someone else had encountered this particular > problem with AppNap and had something to share. > > Paul
JavaAppLauncher
Just noticed this in Console.app when launching an application without an embedded JRE… 2/22/14 5:57:39.093 PM JavaAppLauncher[5669]: objc[5669]: Class JavaLaunchHelper is implemented in both /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib and /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. Any concern? Michael Hall trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter
Re: Disabling AppNap from java
On Sat, Feb 22, 2014 at 4:49 PM, Paul Taylor wrote: > On 22/02/2014 20:43, Eirik Bakke wrote: > >> JNA might be a simpler way to call native functions: >> https://github.com/twall/jna >> >> ... > > > I think JNA or its own is Wndows only isnt it, but there is something > called rococoa. > To be honest I was hoping someone else had encountered this particular > problem with AppNap and had something to share. > > Paul > JNA works on Windows, OS X, Linux, and more. However, it is based on C interfaces and calling conventions. Rococoa ( https://code.google.com/p/rococoa/) implements a similar thing for interacting with Objective-C interfaces. Scott
Re: Disabling AppNap from java
On Feb 22, 2014, at 6:23 PM, Scott Palmer wrote: > On Sat, Feb 22, 2014 at 4:49 PM, Paul Taylor wrote: > >> On 22/02/2014 20:43, Eirik Bakke wrote: >> >>> JNA might be a simpler way to call native functions: >>> https://github.com/twall/jna >>> >>> ... >> >> Not that more native choices are whats needed but if we are tossing out different options for that then… For my HalfPipe application I set up a simple jNI interface to the command line interface for FScript http://www.fscript.org Which is supposed to be a smalltalk-like Cocoa interface. I think I had some fairly simple ObjectiveC runtime interface code in place for JRuby using FFI This was sort of like JNIDirect which was something Patrick Beard came up with a while back when JDirect was going away, or shortly after it had gone away. Michael Hall trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter > >> I think JNA or its own is Wndows only isnt it, but there is something >> called rococoa. >> To be honest I was hoping someone else had encountered this particular >> problem with AppNap and had something to share. >> >> Paul >> > > JNA works on Windows, OS X, Linux, and more. However, it is based on C > interfaces and calling conventions. Rococoa ( > https://code.google.com/p/rococoa/) implements a similar thing for > interacting with Objective-C interfaces. > > Scott
Re: Disabling AppNap from java
For doing simple Objective-C things like this, I wrote an objective-c bridge. It uses JNA and allows you to access any OS X SDK without having to generate stub classes for them (like you do with rococoa). https://github.com/shannah/Java-Objective-C-Bridge Some sample code to give you an idea: WebView : https://github.com/shannah/Java-Objective-C-Bridge/blob/master/java/test/ca/weblite/objc/TestWebView.java NSOpenPanel : https://github.com/shannah/Java-Objective-C-Bridge/blob/master/java/test/ca/weblite/objc/NSOpenPanelSample.java Loading a nib file: https://github.com/shannah/Java-Objective-C-Bridge/blob/master/java/test/ca/weblite/objc/LoadNibSample.java Steve On Sat, Feb 22, 2014 at 4:53 PM, Michael Hall wrote: > On Feb 22, 2014, at 6:23 PM, Scott Palmer wrote: > > > On Sat, Feb 22, 2014 at 4:49 PM, Paul Taylor > wrote: > > > >> On 22/02/2014 20:43, Eirik Bakke wrote: > >> > >>> JNA might be a simpler way to call native functions: > >>> https://github.com/twall/jna > >>> > >>> ... > >> > >> > > Not that more native choices are whats needed but if we are tossing out > different options for that then... > > For my HalfPipe application I set up a simple jNI interface to the command > line interface for FScript > http://www.fscript.org > Which is supposed to be a smalltalk-like Cocoa interface. > > I think I had some fairly simple ObjectiveC runtime interface code in > place for JRuby using FFI > > This was sort of like JNIDirect which was something Patrick Beard came up > with a while back when JDirect was going away, or shortly after it had gone > away. > > Michael Hall > > trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz > > HalfPipe Java 6/7 shell app > http://www195.pair.com/mik3hall/index.html#halfpipe > > AppConverter convert Apple jvm to openjdk apps > http://www195.pair.com/mik3hall/index.html#appconverter > > > > > > > >> I think JNA or its own is Wndows only isnt it, but there is something > >> called rococoa. > >> To be honest I was hoping someone else had encountered this particular > >> problem with AppNap and had something to share. > >> > >> Paul > >> > > > > JNA works on Windows, OS X, Linux, and more. However, it is based on C > > interfaces and calling conventions. Rococoa ( > > https://code.google.com/p/rococoa/) implements a similar thing for > > interacting with Objective-C interfaces. > > > > Scott > > -- Steve Hannah Web Lite Solutions Corp.
Environment variables
I think I asked this before. I'm not sure it was answered, not remembering the answer anyhow. Should java System.getenv pick up ones that are added with LSEnvironment in the Info.plist file? It doesn't seem to. What would be a workaround for java code that depends on things like a HOME directory set? Michael Hall trz nio.2 for OS X http://www195.pair.com/mik3hall/index.html#trz HalfPipe Java 6/7 shell app http://www195.pair.com/mik3hall/index.html#halfpipe AppConverter convert Apple jvm to openjdk apps http://www195.pair.com/mik3hall/index.html#appconverter