Re: Application Support directory to classpath
> On Mar 11, 2016, at 3:47 AM, Michael Hall <mik3h...@gmail.com> wrote: > >> > > Maybe someone else can answer the question of whether or not this has been > considered for sandboxed java applications so that you actually do get > something different for these properties that is usable? Given no one has tried answering this I would either assume sandboxed settings aren’t different or people who know if they are different aren’t following the list anymore. It doesn’t seem all that bad an idea to me. With applications getting more complex having different possible settings for some of these properties could make sense. Say signed and sandboxed versus not MAS targeted could have different user.dir settings. Meanwhile, since I am not currently MAS targeted I will see what I can do with Application Support, although that is really not all that different from using user.home/user.dir. javapackager user.dir I think had user.dir set to the app path itself. Useful for read access of your own app files, but not for storing data assuming you are in the Application directory with no write permissions. Again since the Apple jvm’s (user.dir was always the app's directory as I remember) I think this setting has changed a couple of times. javapackager may of changed again I vaguely remember. My last couple tries with javapackager didn’t successfully get me valid application bundles at all, but it wasn’t anything I needed critically. I will take a look at your links. Thanks. Michael Hall
nio.2 file attributes for OS X
fwiw, After a recent discussion I have updated my github trz project, the ant file now at least includes something to compile the java, which after a couple tweaks it did last night successfully. Still a little thrown together so if anyone tries it and has any problems please let me know. It must of been very thrown together last time, it was a mess. In the interest of ‘eating my own dog food’ I have just added the jar and dylib to my HalfPipe app. I intend to do some things with external files and I think the Mac specific file attributes in trz could be useful. The app does still launch so changing the default FileSystemProvider appears to cause no initial problems. For about everything except additional OS X specific nio.2 file attributes it should fall back to the jvm provided default FileSystemProvider. https://github.com/mik3hall/trz <https://github.com/mik3hall/trz> https://www195.pair.com/mik3hall/halfpipe.dmg <https://www195.pair.com/mik3hall/halfpipe.dmg> Although HalfPipe with the nio.2 related hasn’t been uploaded yet. Michael Hall
Re: Setting created timestamp of files using BasicFileAttributeView
> On Mar 6, 2016, at 7:01 AM, Robert Krüger <krue...@lesspain.de> wrote: > When I set creation date using a cocoa call > (NSFileManager:setAttributes:ofItemAtPath:error:) mapped to java, behaviour > is as expected and creation date is changed. I filed a jdk bug report (Review > ID: JI-9031479). OK, should be a long term fix unless they decide for some reason changing this should not be allowed and that is for some reason the ‘expected behavior’. I think one of the posts I had a url on said it doesn’t work on Linux systems either. I could add it to mine based on your code, or you could I guess, the source is on github. As I remember you would need to specify my OS X specific filesystem(provider) as a jvm launch parameter. It is the same as the usual I think (falling through to the default filesystem(provider) for about everything except adding the additional OS X file attribute views. Again a lot of the api’s don’t support update as I was sort of waiting for interest on the read only attributes, which hasn’t yet really been indicated, before making the code ‘more serious’. It does have a currently non-functioning WatchService, so if you need one of those that works it might not be for you. Although, I may of had a property switch or something that let you fallback to the default there as well. It’s been a while for most of this, I don’t remember. Michael Hall
Re: Setting created timestamp of files using BasicFileAttributeView
> On Mar 6, 2016, at 5:28 AM, Robert Krüger <krue...@lesspain.de> wrote: > > > > On Sat, Mar 5, 2016 at 3:23 PM, Michael Hall <mik3h...@gmail.com > <mailto:mik3h...@gmail.com>> wrote: >> On Mar 5, 2016, at 7:15 AM, Robert Krüger <krue...@lesspain.de >> <mailto:krue...@lesspain.de>> wrote: >> >> > > This…, > https://stackoverflow.com/questions/9198184/setting-file-creation-timestamp-in-java > > <https://stackoverflow.com/questions/9198184/setting-file-creation-timestamp-in-java> > seems to suggest that File.setLastModified will accomplish what you wan on OS > Xt. > > No, that's what I started with and it does what it's documented to do. I’m assuming ‘what it’s documented to do’ means it changes something other than finder creation date/time. Maybe the stack overflow link I posted wasn’t concerned with changing Finder related. These suggest using the ‘touch’ or ‘SetFile’ commands could accomplish this... https://medium.com/@danilosapad/how-to-change-a-file-s-last-modified-and-creation-dates-on-mac-os-x-494f8f76cdf4#.y8qxzwtgg <https://medium.com/@danilosapad/how-to-change-a-file-s-last-modified-and-creation-dates-on-mac-os-x-494f8f76cdf4#.y8qxzwtgg> https://apple.stackexchange.com/questions/99536/changing-creation-date-of-a-file <https://apple.stackexchange.com/questions/99536/changing-creation-date-of-a-file> you could probably runtime exec those from java easily enough. Changing even from native seems like it could be a little tricky for some reason. At least this link suggests it might be... https://stackoverflow.com/questions/6905503/setting-nsfilecreationdate-has-no-effect <https://stackoverflow.com/questions/6905503/setting-nsfilecreationdate-has-no-effect> My trz code does support some cocoa/NSFileManager type attributes… https://github.com/mik3hall/trz/blob/master/src/us/hall/trz/osx/test/MacAttributesTest.java <https://github.com/mik3hall/trz/blob/master/src/us/hall/trz/osx/test/MacAttributesTest.java> shows junit tests of some of the api’s supported. For Cocoa it has this. @Test public void testCocoa() { try { File f = new File("build.xml"); Path p = f.toPath(); Map<String,Object> attrs = Files.readAttributes(p,"mac_cocoa:*"); assertEquals(17,attrs.size()); assertFalse(((Boolean)Files.getAttribute(p,"mac_cocoa:NSFileBusy")).booleanValue()); assertEquals(Files.size(p),((Long)Files.getAttribute(p,"mac_cocoa:NSFileSize")).longValue()); attrs = Files.readAttributes(p,"mac_cocoa:NSFileModificationDate,mac_cocoa:NSFilePosixPermissions"); assertEquals(2,attrs.size()); } catch (IOException ioex) { fail(ioex.toString()); } } Updating may not be supported. But could be added if you or anyone else want to use it. I didn’t want my first feedback on the code to be that someone tried it and something got messed up on their machine. “Hey, I tried your code and it turned all the files orange”. (I think I did include that possibility for FinderInfo though… Files.setAttribute(p, "mac_finder:label", "orange”); it was just kind of fun). This would do all the native for you and allow you to do what you want in the nio.2 way. Assuming I can get it to work. Despite the last stack overflow post it doesn’t seem like it should be all that difficult. Michael Hall
Re: Quaqua
On Aug 1, 2015, at 5:34 AM, Robert Krüger krue...@lesspain.de wrote: On Fri, Jul 31, 2015 at 11:26 PM, Michael Hall mik3h...@gmail.com mailto:mik3h...@gmail.com wrote: If of interest to anyone I happened to stumble across this and took a look for some reason… http://www.randelshofer.ch/quaqua/ http://www.randelshofer.ch/quaqua/ It was very interesting when it started but since its main developer turned his attention to something else, I think this can be considered rather a dead project. This is the original page though. Werner Randelshofer’s. Not much else on the page appears different from what I remember but it does look he now has openjdk versions at least available. It wasn’t a bad look and feel. I used it for a couple things. In particular file dialogs where no one usually seems happy with the defaults. The main reason I thought it might be of interest though is that this is the original author who appears to have be doing at least a little ongoing support. Michael Hall
Quaqua
If of interest to anyone I happened to stumble across this and took a look for some reason… http://www.randelshofer.ch/quaqua/ http://www.randelshofer.ch/quaqua/ Downloads Version 9 For Java SE 6 – 8 on OS X 10.5 – 10.9. Supports Intel Macs. Michael Hall
Re: com.apple.concurrent.Dispatch in the modular JDK
On May 19, 2015, at 7:01 PM, Phil Race philip.r...@oracle.com wrote: Apple's JDK 6 provided the non-standard com.apple.concurrent.Dispatch class which was a means for Java code to access Apple's libdispatch. To quote the documentation at http://www.coderanch.com/how-to/javadoc/appledoc/api/com/apple/concurrent/Dispatch.html http://www.coderanch.com/how-to/javadoc/appledoc/api/com/apple/concurrent/Dispatch.html Is this the only list you’re raising the issue on? Given this project is inactive you might find more current OS X developers on other lists. There are 173k hits on google for… com.apple.concurrent.Dispatch Most of the first hits do seem to be SWT. Isn’t there some place you can leave the source for the Mac specific stuff you decide to phase out just in case someone decides to yell later? Some repository somewhere maybe. Me? Don’t remember ever hearing of it and it won’t matter at all. Michael Hall
Re: jdeps command
On Apr 30, 2015, at 6:21 PM, Mandy Chung mandy.ch...@oracle.com wrote: On 04/30/2015 04:17 PM, Michael Hall wrote: On Apr 30, 2015, at 5:39 PM, Mandy Chung mandy.ch...@oracle.com wrote: and existing tool may be removed (e.g. jhat [1]). Not through Java 9 ea? jhat -version jhat version 2.0 (java version 1.9.0-ea) So I would think it might be a little premature for Mike to remove the link on this one? Right - things may change during JDK 9 development and should wait until GA. My main point is that the list of JDK tools could be different for any release. Mandy OK, I guess for the Apple changes it would be up to Mike Swingler how he wants to handle this. This is good to be aware of. My main concern was jdeps since my understanding is it will be an important tool for Java 9 and jigsaw coming up. Thanks all. Michael Hall
Re: jdeps command
On Apr 29, 2015, at 4:41 PM, David DeHaven david.deha...@oracle.com wrote: My solution is to put this in ~/.profile and skip using the stub tools in /usr/bin: Again, I have no problem with a user having their own fix in a startup shell script. Although, this one I might have to take a closer look at to completely understand what it’s doing. But what about a distributed shell script? You would probably assume that anyone providing one for OS X would have tested on the platform. But what if they try to write a generic Unix type script. It seems like most of those that I see prefer specifying /usr/bin/java rather than just ‘java’. I just wonder if there wouldn’t be some way to have a platform wide mechanism. Build something in the java installer maybe that makes sure the complete set of /usr/bin links is there? Or if scripts like this start getting to OS X with /usr/bin/jdeps they will break. Michael Hall
Re: codesign crashes since XCode 6.3/OS X 10.10.3
On Apr 16, 2015, at 3:48 AM, Hendrik Schreiber h...@tagtraum.com wrote: The problem seems to be connected to Apple’s timestamp server timestamp.apple.com/17.151.28.7. When I add the flag --timestamp=none signing works as expected. Just FYI: In the meantime Apple has acknowledged the bug as a duplicate of 20249918. Sounds like other people are having this problem as well and Apple is “working on it”. http://stackoverflow.com/questions/11712322/error-the-timestamp-service-is-not-available-when-using-codesign-on-mac-os-x Michael Hall
Re: codesign crashes since XCode 6.3/OS X 10.10.3
On Apr 12, 2015, at 10:21 AM, Hendrik Schreiber h...@tagtraum.com wrote: The same line worked just fine before the upgrade to XCode 6.3/ OS X 10.10.3. Does anybody else have this problem (and perhaps a solution)? Or asked the other way around: Has anybody succeeded signing an app with a bundled JDK 1.8.0_40? Just trying to figure out whether it’s me doing something stupid or codesign is simply broken. Seemed to work fine for me from Terminal My.app: replacing existing signature My.app: signed bundle with Mach-O thin (x86_64) [some.identifier.of.mine] Michael Hall
Re: codesign crashes since XCode 6.3/OS X 10.10.3
On Apr 12, 2015, at 2:23 PM, Hendrik Schreiber h...@tagtraum.com wrote: e] Thanks, Michael. Are you copying the whole JDK or just parts? Actually that was a version of my application I was trying to embed the Java 9 early access into to have a test version with that. As far as the jdk goes I think what I did was generate a default Java 8 application with javapackager. This signed it, automatically, I didn’t have to identify the signing ID. I went into the application Plugins directory until I saw the Home directory. I removed that one and copied in the one from the Java 9 JDK. Probably should of broke the signature. I then signed that bundle as indicated in your email. Didn’t remember the codesign options myself. I probably should of done that before uploading the application. But anyone interested in the uploaded is probably interested in hacking on it anyhow so a valid signature wouldn’t matter. Michael Hall
Re: Deployment
On Mar 30, 2015, at 10:45 AM, David DeHaven david.deha...@oracle.com wrote: Brief question. What is the recommended deployment tool for applications at this time? Found that there had been some discussion on the Kenai AppBundler list that mentioned javapackager. Looking at that now. Java Packager included with the JDK is under (very) active development. The AppBundler project is no longer active. Java packager discussion should be done on the OpenJFX mailing list, it was originally JavaFX packager (but it's always supported non-FX applications, hence the name change). I haven’t done any JavaFX yet either. Just as long as it isn’t a requirement for use of the deployment tool. 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: Deployment
On Mar 31, 2015, at 11:03 AM, David DeHaven david.deha...@oracle.com wrote: I was trying to figure out some way to have 8 the default and still have 9 available for testing last night. Still working on it. Just move it out of /Library/Java/JavaVirtualMachines, then the stub tools won't be able to find it. Once moved you can use JAVA_HOME to tell the stub tools to use it or call it directly. Since I do most of my testing with one particular application of my own. I was trying to figure out how to embed Java 9 JRE or JDK into a copy of the application. I haven’t done that much with embedding. It seemed to indicate different files missing. I was thinking this was because the directory structure I was copying into Plugins wasn’t starting at the right place. I started wondering if the JavaAppLauncher code as is would even work with the current Java 9 JRE/JDK? I was then thinking that I’d launch some other way. Maybe make the application launch executable a bash script. I might loose AppleEvents that way though and the app just might have launch dependencies on running some AppleScript’s. It has become OS X’ified over time since I last tried doing anything with it on Windows. Do you know should JavaAppLauncher work with the Java 9 builds? 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: MAS codesign requirements break Java app signing
On Nov 9, 2014, at 6:10 PM, Zach Oakes zsoa...@gmail.com wrote: Can you elaborate on what you are trying to say? As I mentioned, I already ran codesign -dv MyApp.app, and it does indeed show version=2. Yet, I still get the error from Apple after uploading. Sorry, I had read your poset a little while back and missed the significance of that until after I focused on the so I think I am using v2 signatures. “ and did some checking myself to see how you would display that. Not sure, otherwise, the Mavericks section also has… • It records substantially all files by default. There are no default holes (omit rules). • It records nested code (frameworks, dylibs, helper tools and apps, plug-ins, etc.) by recording their code signature for verification. • It records symbolic links. Version 1 resource envelopes ignore symlinks. There was some mention awhile ago I think that a jli(?) lib used a symbolic link or something like that? That might of been mentioned on the old Apple java-dev list. Would cause a problem now. You could ‘ls’ all the files in your embedded jre checking for any sum version=2 rules=12 files=7 Since it is now “all files” you could verify the file count in your bundle is actually 7? 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: Javafxpackager and splash screen
On Apr 13, 2014, at 11:10 AM, Abu Abdullah falcon.sh...@gmail.com wrote: Can you please try the following test sample on your machine. ideally it should work but it is not in my case: https://drive.google.com/file/d/0B6nSYRwywQUoNzV5RHh5bWl6amc/edit?usp=sharing the code is compiled with 1.8, you just need to modify the splash path in your case. Sorry not 1.8. If you think the path is correct you probably have a bug. 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: Javafxpackager and splash screen
On Apr 11, 2014, at 9:38 PM, Abu Abdullah falcon.sh...@gmail.com wrote: On Sat, Apr 12, 2014 at 6:19 AM, Michael Hall mik3h...@gmail.com wrote: i tried even the absolute path in case APP_ROOT is not supported but not working. I seem to remember support for something like this being added. But am not sure. You could check the source. I tried also with jdk1.8.0 u20 as well but it is the same version javafxpackager 2.2 I looked at the last appbundler source I have downloaded, which may not be current. But saw no support for APP_ROOT in main.m. To be sure you could download the latest and check yourself. From this, APP_ROOT would not work, you might show how you specified fullpath? Path wrong could still be a reason it doesn't work that doesn't mean a bug. yes it runs through command line and I'm trying with both 1.8.0 and u20 In the most current version of the source that I have, again possibly not the actual latest - then it should work application launched. The source has… // Get the VM options NSArray *options = [infoDictionary objectForKey:@JVM_OPTIONS_KEY]; if (options == nil) { options = [NSArray array]; } … // Initialize the arguments to JLI_Launch() int argc = 1 + [options count] + 2 + [arguments count] + 1; char *argv[argc]; int i = 0; argv[i++] = commandName; argv[i++] = strdup([classPath UTF8String]); argv[i++] = strdup([libraryPath UTF8String]); for (NSString *option in options) { argv[i++] = strdup([option UTF8String]); } So it just copies in the options, no editing, skipping or additions. Should be just like command line. So if path is good, and it doesn't correctly handle the splash option, then something is broken somehow that isn't broken in command line and you probably have a bug report? 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: Javafxpackager and splash screen
i tried even the absolute path in case APP_ROOT is not supported but not working. I seem to remember support for something like this being added. But am not sure. You could check the source. For some reason, I'm not able to do it even using the infinitekind appbundler, maybe it is not supporting jdk 1.8 Any help is appreciated. It is probably not a problem in passing the JVMOption, I would guess about anything you say is a JVMOption is probably passed as is without much, if any, editing. If this is true then appbundler or infinitekind shouldn't matter. The problem would probably be the OS X port support of the splash option. Does it run command line? java -splash:path/to/image ... I think you would need the 1.8 JDK installed to check this. 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: JavaAppLauncher and working directory
On Apr 6, 2014, at 11:02 PM, Abu Abdullah falcon.sh...@gmail.com wrote: Launcher.jar is just a wrapper instead of executing through the command line. it has only manifest.mf file with Main-Class: classes.myapp and other options. the classes are in a folder in the same directory. user.dir for app bundler defaults to your user home directory. Trying to access anything off that inside your application bundle can't really be counted on. this is my problem, I'm not able to see other folders in the same /Contents/Java. it seems the classes are executed as part of the classpath and not the working directory that it should be in. I believe the way this works is that any jars in the Java directory are added to classpath _but_ the Java directory itself is not classpath. The Classes directory it contains is in classpath. For example: set java.class.path java.class.path=/Users/mjh/HalfPipe/HalfPipe7.app/Contents/Java/Classes:/Users/mjh/HalfPipe/HalfPipe7.app/Contents/Java/antlr-2.7.7.jar:…[Other jars in the Java directory automatically added].../Users/mjh/HalfPipe/HalfPipe7.app/Contents/Java/weka.jar Notice Java directory itself not there. Java/Classes is there. So that you can access resources off of that with something like… try { ClassLoader cl = new java.net.URLClassLoader(new java.net.URL[0]); BufferedReader rdr = new BufferedReader(new InputStreamReader(cl.getResourceAsStream(Scripts/loader.js))); jsEngine.eval(rdr); } catch (Exception ex) { ex.printStackTrace(org.cmdline.common.Configuration.getSysOut()); } Where Scripts/loader.js is located in the above mentioned Classes directory. user.dir I would still suggest is not a reliable way to access application files going forward. i will try now with Joe suggestion to go with the new fx packager, it is certainly the way forward. If this provides equivalent functionality and is active this would probably be the way to go. Given the time, I will look at it. Any handy OS X specific documentation links would be appreciated. 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: JavaAppLauncher and working directory
On Apr 6, 2014, at 2:10 AM, Abu Abdullah falcon.sh...@gmail.com wrote: I'm using scripting to do this and not by AppBundler. Once i launch the application, it didn't recognize its location and hence other folders are not seen. NullPointerException are thrown because of this. I tried many things without successful e.g. -Duser.dir in the info.plist, copying the files to many places in root, in MacOS folder, in Resources folder, in Resources/Java folder. I'm not able to launch it. I'm troubleshooting by running ./JavaAppLauncher Did you update Info.plist to indicate the embedded JRE? What do you mean by the Launcher.jar has no classes? How does it work without classes? Where are the classes? user.dir for app bundler defaults to your user home directory. Trying to access anything off that inside your application bundle can't really be counted on. 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: JavaAppLauncher and working directory
On Apr 6, 2014, at 9:45 AM, Joe McGlynn joe.mcgl...@oracle.com wrote: don’t believe the “app bundler” project is maintained any longer. That code was subsumed into the “FX Packager” (which works for non-FX apps) about a year ago. FWIW, I suspect that you need to put your application classes into a JAR file for it to work properly, but that is just a guess. I’d recommend starting with the packager tool that is in the EA release of 8u20, it has been significantly updated for this release and if you discover a problem or feature gap that is where we’ll be working to address it. The output of this is a Mac java application bundle? Consistent with how appbundler works? /Contents/Java automatically added to class path? Support for embedded JRE? MacOS directory added to java.library.path? user.dir set to users home directory. The features applications written to appbundler could expect as I remember right now. 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: FileAttributeView for tags and colors?
On Feb 27, 2014, at 4:48 PM, Hendrik Schreiber h...@tagtraum.com wrote: On Feb 27, 2014, at 23:35, Michael Hall mik3h...@gmail.com wrote: On Feb 27, 2014, at 3:51 PM, Hendrik Schreiber h...@tagtraum.com wrote: Again fwiw, my trz package has support for a lot of different OS X file attributes, including old 'classic', file colors. I sort of liked the idea of color being a file attribute myself. Not your usual one. I am not 10.9 yet but when I get there if this API concerns this same sort of thing I would be happy to include it in trz anyhow. It is quite possible to add something like this along with a 'pass through' type file system. So you could possibly come up with it yourself without excessive effort. Thanks for the pointer, Michael. For my own needs, I will probably just roll my own (since the API is trivial), but for the future I wouldn't mind seeing APIs like this exposed through the regular JDK. And if nobody asks for it, it never gets done...so I ask. ;-) I might think, not necessarily. I tend to disagree. Something like this could be provided by the JDK itself. It could be provided for, say the platform (like my trz package), by someone interested in the API's or java on the platform. It could be provided by anyone with a particular need for some platform specific file attribute for their own code. 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: Unable to get Applescript Engine on some computers
On Feb 27, 2014, at 4:52 AM, Paul Taylor paul_t...@fastmail.fm wrote: In my code I have: ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine engine = mgr.getEngineByName(AppleScript); this works fine for me, but for some customers in returns null for engine. We are using Java 1.8.0 25.0-b69 64bit (build 129) Customer was on Mac OS X 10.9.2 x86_64, I've upgraded to same version still don't get the problem. Applescript does exist because earlier in my code I run some applescript using osascript and Runtime class and that works fine l don't know that it was precisely determined what caused this. Possibly some change in an OS upgrade where Apple removed something from their java distribution? Although we didn't know it, we were relying on the Apple code being in place. Your three options would be… 1) Provide the code in the jar and dylib yourself. This is what I did and what I made available on github at… https://github.com/mik3hall/AppleScriptEngine All you really need are the jar and dylib. Put the dylib in the application's MacOSX folder. appbundler adds that to LD_LIBRARY_PATH. Put the jar in the application's Java folder, this should get it into class path. Done and should work on any configuration. 2). Fix the openjdk configuration error yourself. This means adding the AppleScriptEngine entry to the config file in resources.jar. I believe the bug report I gave earlier details how to do that. 3). Wait for openjdk to correct the configuration file in resources.jar My understanding on that one anyhow. 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: Unable to get Applescript Engine on some computers
On Feb 27, 2014, at 8:30 AM, Paul Taylor paul_t...@fastmail.fm wrote: FYI I tried this, and it worked ! Brilliant thanks solved a big problem for me Glad to hear it worked for you. I hope it is for anyone trying out my application. 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: FileAttributeView for tags and colors?
On Feb 27, 2014, at 3:51 PM, Hendrik Schreiber h...@tagtraum.com wrote: Hey there, I was wondering, wouldn't the tags/colors API in OS X 10.9 be a really nice candidate for a java.nio.file.attribute.FileAttributeView? Is an appropriate implementation planned? I wasn't able to find an RFE on https://bugs.openjdk.java.net Again fwiw, my trz package has support for a lot of different OS X file attributes, including old 'classic', file colors. I sort of liked the idea of color being a file attribute myself. Not your usual one. I am not 10.9 yet but when I get there if this API concerns this same sort of thing I would be happy to include it in trz anyhow. It is quite possible to add something like this along with a 'pass through' type file system. So you could possibly come up with it yourself without excessive effort. 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: Environment variables [Partly solved]
On Feb 25, 2014, at 2:39 PM, Michael Hall mik3h...@gmail.com wrote: I think I did get setting R_HOME to work last night, instead of hanging the app actually crashed. Any tricks to getting crash logs these days I might of missed? Fwiw. Set but set incorrectly. Managed to see the error message correctly finally. I had to activate some simple JNI I had written earlier that implements a PrintStream around some JNI NSLog's to get messages in console again. Then figured out the message I was missing was going to err not out. Anyhow, googling the message seemed to say some sample code I was basing setting R_HOME on was wrong. It had to be to the directory, not the executable. So then… us.hall.scripting.RS jri loaded true Rengine starting... Starting R... Rengine Mac code Rengine: setting R_HOME to /Library/Frameworks/R.framework/Resources setupR got 0 t = 3 class(t) [CTRL_D] numeric Some of those obviously debug messages that can now be removed but working for that part anyhow. Thanks. 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: JavaAppLauncher
On Feb 24, 2014, at 3:52 PM, David DeHaven david.deha...@oracle.com wrote: 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? That's a known issue, the message is benign as both instances of JavaLaunchHelper are the same. Thanks. I was thinking I'd bug report that one otherwise. 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: Environment variables
On Feb 24, 2014, at 4:10 PM, David DeHaven david.deha...@oracle.com wrote: 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? Launching from Finder or other LaunchServices method? It has no effect when launching from the command line. Is it sandboxed? I don't know if sandboxing has an effect on LSEnvironment, but I suspect it might considering it's been exploited to infect machines with trojans (via DYLD_INSERT_LIBRARIES). What are you ultimately trying to accomplish? Application. Signed, not sandboxed. Something recently, Lion - Mountain Lion maybe? seemed not to work unless I signed it. So I self-signed. I first looked at this a while ago I think before it was even signed and still couldn't get it to work. I'm trying to interface 3rd party code to my HalfPipe application. It's a JSR 223 interface to the R language. https://rforge.net/rscript/ It seems to require a R_HOME environment variable set. Which so far, I can't give it with LSEnvironment through the plist. 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: Environment variables
On Feb 24, 2014, at 5:15 PM, David DeHaven david.deha...@oracle.com wrote: Application. Signed, not sandboxed. Something recently, Lion - Mountain Lion maybe? seemed not to work unless I signed it. So I self-signed. I first looked at this a while ago I think before it was even signed and still couldn't get it to work. I don't know what the core issue is but my own (personal) experience has been that LSEnvironment isn't reliable. I'm trying to interface 3rd party code to my HalfPipe application. It's a JSR 223 interface to the R language. https://rforge.net/rscript/ It seems to require a R_HOME environment variable set. Which so far, I can't give it with LSEnvironment through the plist. Requiring R_HOME to be set in the environment seems sketchy to me. At worst you should be able to set it through a system property, not rely on the environment. Is it open source? Maybe it could be fixed and contributed back. The ugly workaround might be to drill down through JNI to call setenv, if it can be done early enough. Given LSEnvironment not seeming to work at all. I should probably set up some other test cases and see if this seems to hold consistently. But given that, I am already considering the workarounds. The property is required by the native code, getenv(), where System.property not quite as preferred as in Java? Anyhow, current efforts on the 'ugly workaround'. Somehow do a setenv myself. Thanks. 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
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 Feb 22, 2014, at 6:23 PM, Scott Palmer swpal...@gmail.com wrote: On Sat, Feb 22, 2014 at 4:49 PM, Paul Taylor paul_t...@fastmail.fm 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: AppleScript script engine
On Feb 15, 2014, at 11:00 AM, Scott Palmer swpal...@gmail.com wrote: Maybe, but I don't think so. I think that stuff is part of the magic that makes JAVA_HOME work without messing around with the path. I think OpenJDK has a JIRA bug system now, but the usual place at oracle.com still works. Scott I was sort of remembering glancing at this one a while back. I just remembered it seemed to say there were choices for bug filing. http://lists.apple.com/archives/java-dev/2014/Jan/msg00038.html Everyone with OpenJDK Author status or above has a JBS account which may be used to create and edit bugs. Those without accounts can view bugs anonymously. Yeah - if you're not an OpenJDK developer, please continue to use bugs.java.com instead, as before. I guess I'll use bugs.java.com. 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: AppleScript script engine
On Feb 15, 2014, at 11:00 AM, Scott Palmer swpal...@gmail.com wrote: Maybe, but I don't think so. I think that stuff is part of the magic that makes JAVA_HOME work without messing around with the path. It looked like most of the java commands default link to the Apple Java 6 versions. I set up this in my bash profile jdkhome=`/usr/libexec/java_home -v 1.7` alias jrunscript7=$jdkhome/bin/jrunscript I'm a little leery of using JAVA_HOME having a number of times seen people have problems they couldn't figure out that turned out to be because they JAVA_HOME set and forgot about it. jrunscript7 -q Language ECMAScript 1.8 implemention Mozilla Rhino 1.7 release 3 PRERELEASE But it still doesn't work. I guess I'd better figure out the resources configuration file Alan Bateman mentioned. 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: AppleScript script engine
On Feb 15, 2014, at 10:02 AM, Alan Bateman alan.bate...@oracle.com wrote: On 15/02/2014 14:27, Michael Hall wrote: : Sorry Scott, put you in Led Zeppelin there for a bit. Except for Scott's 1.7.0_51, his and Alan's look to be later versions, so we might assume more recent builds have this fixed? I took a quick poke around and I now see that the reason AppleScript is located on my system is because ServiceLoader is locating the service configuration file in /System/Library/Java/Extensions/AppleScriptEngine.jar. Although the AppleScript script engine is included in rt.jar, there isn't in fact a service configuration file for it resources.jar (resources.jar because that is where resources go in the JDK at this time). So I would suggest submitting a bug on this. jar -uf resources.jar META-INF/services/javax.script.ScriptEngineFactory jrunscript -q Language AppleScript 2.2.4 implemention AppleScriptEngine 1.1 Language ECMAScript 1.8 implemention Mozilla Rhino 1.7 release 3 PRERELEASE Thanks, 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: OSX Java 8 crash on Mavericks
On Feb 14, 2014, at 4:58 AM, Paul Taylor paul_t...@fastmail.fm wrote: Crashed Thread: 0 AppKit Thread Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes: KERN_PROTECTION_FAILURE at 0x0001043d5000 Application Specific Information: *** Terminating app due to uncaught exception 'JavaNativeException', reason: 'java.lang.StackOverflowError' terminating with uncaught exception of type JNFException abort() called Not sure what you mean by update? If you have a bug report? The above sort of suggests you have something looping or too recursive going on with the native gui thread. Probably in or calling into native. Thread 0 Crashed:: AppKit Thread Dispatch queue: com.apple.main-thread … 16 com.apple.HIToolbox 0x7fff8ac65abc _BlockUntilNextEventMatchingListInModeWithFilter + 65 17 com.apple.AppKit 0x7fff8de7228e _DPSNextEvent + 1434 18 com.apple.AppKit 0x7fff8de718db -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122 19 libosxapp.dylib 0x00012914b6d4 -[NSApplicationAWT nextEventMatchingMask:untilDate:inMode:dequeue:] + 124 20 com.apple.AppKit 0x7fff8de659cc -[NSApplication run] + 553 21 libosxapp.dylib 0x00012914b4e8 +[NSApplicationAWT runAWTLoopWithApp:] + 156 22 libawt_lwawt.dylib0x0001290dbafb -[AWTStarter starter:] + 873 23 com.apple.Foundation 0x7fff888be0de __NSThreadPerformPerform + 229 24 com.apple.CoreFoundation 0x7fff907cb8f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 25 com.apple.CoreFoundation 0x7fff907bd062 __CFRunLoopDoSources0 + 242 26 com.apple.CoreFoundation 0x7fff907bc7ef __CFRunLoopRun + 831 27 com.apple.CoreFoundation 0x7fff907bc275 CFRunLoopRunSpecific + 309 28 libjli.dylib 0x0001032e5b33 CreateExecutionEnvironment + 871 29 libjli.dylib 0x0001032e1ad4 JLI_Launch + 1952 30 com.jthink.songkong 0x0001032668ab launch + 5243 31 com.jthink.songkong 0x0001032652e6 main + 102 32 com.jthink.songkong 0x000103265274 start + 52 Not an expert but a guess would be in starting up AWT on application launch. Maybe event related, again from the exception maybe too many events or somehow recursive. 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: AppleScript script engine
On Feb 13, 2014, at 7:49 PM, Michael Hall mik3h...@gmail.com wrote: Is the AppleScript engine no longer not even the default one but no longer shipped? Not seeing a reply here. Is there a more appropriate forum for OS X specific java questions now? 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: AppleScript script engine
On Feb 14, 2014, at 5:47 PM, David DeHaven david.deha...@oracle.com wrote: What Java version are you testing? Command line I show... /usr/libexec/java_home --exec java -version java version 1.7.0_40 Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode) Is that the jdk? Probably what jrunscript uses? The application is probably using the 'shared' JRE. alias javajre=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java javajre -version java version 1.7.0_51 Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) If you do the jrunscript -q do you show AppleScript? Thanks for the reply, 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: AppleScript script engine
On Feb 14, 2014, at 9:23 PM, Scott Palmer swpal...@gmail.com wrote: $ jrunscript -q Language AppleScript 2.3 implementation AppleScriptEngine 1.1 Language ECMAScript ECMA - 262 Edition 5.1 implementation Oracle Nashorn 1.8.0 Thanks, not sure why it doesn't show for me then but thanks. I'll verify AppleScript works at all for me and go from there, newer machine might be it somehow. 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: AppleScript script engine
On Feb 13, 2014, at 7:49 PM, Michael Hall mik3h...@gmail.com wrote: Is the AppleScript engine no longer not even the default one but no longer shipped? My HalfPipe application has some launch dependencies on it being there. It was throwing NPE's apparently not getting the engine. I stuck in some code to list out available engines and get… ScriptEngineFactory Info Factory class:class us.hall.scripting.RhinoScriptEngineFactory Script Engine:Rhino JavaScript Script Engine (1.0.0) Engine Alias: javascript Engine Alias: js Engine Alias: mozrhino ScriptEngineFactory Info Factory class:class org.jruby.embed.jsr223.JRubyEngineFactory Script Engine:JSR 223 JRuby Engine (1.7.4) Engine Alias: ruby Engine Alias: jruby ScriptEngineFactory Info Factory class:class com.sun.script.javascript.RhinoScriptEngineFactory Script Engine:Mozilla Rhino (1.7 release 3 PRERELEASE) Engine Alias: js Engine Alias: rhino Engine Alias: JavaScript Engine Alias: javascript Engine Alias: ECMAScript Engine Alias: ecmascript No AppleScript? Quicker command line check I came across on google… jrunscript -q Language ECMAScript 1.8 implemention Mozilla Rhino 1.7 release 3 PRERELEASE Seems to confirm no AppleScript. Intentional? Accidental? If this is Open Classpath can we grab the source and go? 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