Re: Building OpenJDK 8 on 10.6.8

2014-01-07 Thread Robert Krüger
I was afraid so, given at least the retina stuff was probably fixed
using newer APIs.

Thanks! That saved me some time, testing it myself.

On Tue, Jan 7, 2014 at 3:35 PM, Steve Hannah st...@weblite.ca wrote:
 I'm able to use 1.7.0_25 and earlier on 10.6.8, but not the more recent
 versions.

 Steve


 On Tuesday, January 7, 2014, Joe McGlynn wrote:

 Hi Robert,

 JDK 7 is only supported on 10.7.3 and above because there are API
 limitations in versions of OS X below that.  Building the complete JDK (7 or
 8) on lower versions of the JDK is not possible AFAIK.


 On Jan 7, 2014, at 6:00 AM, Robert Krüger krue...@lesspain.de wrote:

  Hi,
 
  I think the official answer to this is 10.7+ is supported but is there
  a possibility to build OpenJDK 8 on 10.6.8 maybe with some
  limitations? Could anyone share information on this?
 
  Thanks,
 
  Robert



 --
 Steve Hannah
 Web Lite Solutions Corp.



Re: White flashing when opening Dialogs, Menus etc.

2014-02-05 Thread Robert Krüger
This is a simple test case for you to reproduce the flashing for
opening a Dialog. It's basically the same for JMenus.

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.plaf.ColorUIResource;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class TestDarkNimbus {

public static void main(String[] args) throws Exception {

for(LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()){
if(info.getName().startsWith(Nimbus)){
System.out.println(Setting Look  Feel to  + info.getName());
UIManager.setLookAndFeel(info.getClassName());
break;
}
}

UIDefaults d = UIManager.getDefaults();
d.put(control, new ColorUIResource(54, 54, 54));
d.put(text, new ColorUIResource(214, 214, 214));
d.put(nimbusBlueGrey, new ColorUIResource(44, 44, 44));
d.put(nimbusBase, new ColorUIResource(54, 54, 54));
d.put(nimbusFocus, new Color(71, 85, 101));
d.put(nimbusLightBackground, new ColorUIResource(54, 54, 54));
d.put(nimbusSelectionBackground, new ColorUIResource(51, 65, 81));
d.put(nimbusSelection, new ColorUIResource(51, 65, 81));

final JFrame frame = new JFrame(TestDarkNimbus.class.getSimpleName());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton button = new JButton(Test Dialog Flashing);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(frame.getContentPane(),
Flash , Flash demo,
JOptionPane.INFORMATION_MESSAGE);
}
});
frame.getContentPane().add(button);
frame.pack();
frame.setLocation(500, 500);
frame.setVisible(true);
}
}

On Mon, Jan 6, 2014 at 6:49 PM, Robert Krüger krue...@lesspain.de wrote:
 Hi,

 we are using a customized Nimbus LF (the customization is mostly
 color changes) with dark backgrounds. Since we migrated our product
 from Apple JDK 6 to OpenJDK 8 each JMenu or JDialog opens and first
 draws a white rectangle that is then quickly replaced by the real
 content, which has a rather unprofessional feel.

 Has anyone had a similar problem and maybe a workaround other than not
 having a dark background? Is there a known Jira issue I can follow?

 I am currently running build 121 in development on Mac OS 10.8.

 Thanks,

 Robert


Re: White flashing when opening Dialogs, Menus etc.

2014-02-05 Thread Robert Krüger
I have done that. Could you let me know what its ID is, once it is
reachable for the public, so I can track it?

On Wed, Feb 5, 2014 at 4:18 PM, Sergey Bylokhov
sergey.bylok...@oracle.com wrote:
 Hi, Robert.
 This is unknown issue. Please file a new bug at
 http://bugreport.sun.com/bugreport
 Thanks!


 On 05.02.2014 19:01, Robert Krüger wrote:

 This is a simple test case for you to reproduce the flashing for
 opening a Dialog. It's basically the same for JMenus.

 import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.UIManager.LookAndFeelInfo;
 import javax.swing.plaf.ColorUIResource;
 import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;

 public class TestDarkNimbus {

  public static void main(String[] args) throws Exception {

  for(LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()){
  if(info.getName().startsWith(Nimbus)){
  System.out.println(Setting Look  Feel to  +
 info.getName());
  UIManager.setLookAndFeel(info.getClassName());
  break;
  }
  }

  UIDefaults d = UIManager.getDefaults();
  d.put(control, new ColorUIResource(54, 54, 54));
  d.put(text, new ColorUIResource(214, 214, 214));
  d.put(nimbusBlueGrey, new ColorUIResource(44, 44, 44));
  d.put(nimbusBase, new ColorUIResource(54, 54, 54));
  d.put(nimbusFocus, new Color(71, 85, 101));
  d.put(nimbusLightBackground, new ColorUIResource(54, 54, 54));
  d.put(nimbusSelectionBackground, new ColorUIResource(51, 65,
 81));
  d.put(nimbusSelection, new ColorUIResource(51, 65, 81));

  final JFrame frame = new
 JFrame(TestDarkNimbus.class.getSimpleName());
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JButton button = new JButton(Test Dialog Flashing);
  button.addActionListener(new ActionListener() {
  @Override
  public void actionPerformed(ActionEvent e) {
  JOptionPane.showMessageDialog(frame.getContentPane(),
 Flash , Flash demo,
  JOptionPane.INFORMATION_MESSAGE);
  }
  });
  frame.getContentPane().add(button);
  frame.pack();
  frame.setLocation(500, 500);
  frame.setVisible(true);
  }
 }

 On Mon, Jan 6, 2014 at 6:49 PM, Robert Krüger krue...@lesspain.de wrote:

 Hi,

 we are using a customized Nimbus LF (the customization is mostly
 color changes) with dark backgrounds. Since we migrated our product
 from Apple JDK 6 to OpenJDK 8 each JMenu or JDialog opens and first
 draws a white rectangle that is then quickly replaced by the real
 content, which has a rather unprofessional feel.

 Has anyone had a similar problem and maybe a workaround other than not
 having a dark background? Is there a known Jira issue I can follow?

 I am currently running build 121 in development on Mac OS 10.8.

 Thanks,

 Robert



 --
 Best regards, Sergey.



Re: White flashing when opening Dialogs, Menus etc.

2014-02-05 Thread Robert Krüger
Thanks

On Wed, Feb 5, 2014 at 7:28 PM, Roger Lewis roger.le...@oracle.com wrote:
 There is an issue with the outbound email that contains the ID. I will let
 you know when the ID is ready.

 -Roger


 On 2/5/14, 10:13 AM, Sergey Bylokhov wrote:

 Hi, Robert.
 What bug Id was reported to you? Try to open the link:
 https://bugs.openjdk.java.net/browse/JI-bug_id

 On 05.02.2014 21:58, Robert Krüger wrote:

 I have done that. Could you let me know what its ID is, once it is
 reachable for the public, so I can track it?

 On Wed, Feb 5, 2014 at 4:18 PM, Sergey Bylokhov
 sergey.bylok...@oracle.com wrote:

 Hi, Robert.
 This is unknown issue. Please file a new bug at
 http://bugreport.sun.com/bugreport
 Thanks!


 On 05.02.2014 19:01, Robert Krüger wrote:

 This is a simple test case for you to reproduce the flashing for
 opening a Dialog. It's basically the same for JMenus.

 import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.UIManager.LookAndFeelInfo;
 import javax.swing.plaf.ColorUIResource;
 import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;

 public class TestDarkNimbus {

   public static void main(String[] args) throws Exception {

   for(LookAndFeelInfo info :
 UIManager.getInstalledLookAndFeels()){
   if(info.getName().startsWith(Nimbus)){
   System.out.println(Setting Look  Feel to  +
 info.getName());
 UIManager.setLookAndFeel(info.getClassName());
   break;
   }
   }

   UIDefaults d = UIManager.getDefaults();
   d.put(control, new ColorUIResource(54, 54, 54));
   d.put(text, new ColorUIResource(214, 214, 214));
   d.put(nimbusBlueGrey, new ColorUIResource(44, 44, 44));
   d.put(nimbusBase, new ColorUIResource(54, 54, 54));
   d.put(nimbusFocus, new Color(71, 85, 101));
   d.put(nimbusLightBackground, new ColorUIResource(54, 54,
 54));
   d.put(nimbusSelectionBackground, new ColorUIResource(51,
 65,
 81));
   d.put(nimbusSelection, new ColorUIResource(51, 65, 81));

   final JFrame frame = new
 JFrame(TestDarkNimbus.class.getSimpleName());
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   JButton button = new JButton(Test Dialog Flashing);
   button.addActionListener(new ActionListener() {
   @Override
   public void actionPerformed(ActionEvent e) {
 JOptionPane.showMessageDialog(frame.getContentPane(),
 Flash , Flash demo,
   JOptionPane.INFORMATION_MESSAGE);
   }
   });
   frame.getContentPane().add(button);
   frame.pack();
   frame.setLocation(500, 500);
   frame.setVisible(true);
   }
 }

 On Mon, Jan 6, 2014 at 6:49 PM, Robert Krüger krue...@lesspain.de
 wrote:

 Hi,

 we are using a customized Nimbus LF (the customization is mostly
 color changes) with dark backgrounds. Since we migrated our product
 from Apple JDK 6 to OpenJDK 8 each JMenu or JDialog opens and first
 draws a white rectangle that is then quickly replaced by the real
 content, which has a rather unprofessional feel.

 Has anyone had a similar problem and maybe a workaround other than not
 having a dark background? Is there a known Jira issue I can follow?

 I am currently running build 121 in development on Mac OS 10.8.

 Thanks,

 Robert



 --
 Best regards, Sergey.






Re: White flashing when opening Dialogs, Menus etc.

2014-02-06 Thread Robert Krüger
Thanks!

On Thu, Feb 6, 2014 at 5:26 PM, Roger Lewis roger.le...@oracle.com wrote:
 The bug can be found here
 https://bugs.openjdk.java.net/browse/JDK-8033786

 -Roger


 On 2/5/14, 10:28 AM, Roger Lewis wrote:

 There is an issue with the outbound email that contains the ID. I will let
 you know when the ID is ready.

 -Roger

 On 2/5/14, 10:13 AM, Sergey Bylokhov wrote:

 Hi, Robert.
 What bug Id was reported to you? Try to open the link:
 https://bugs.openjdk.java.net/browse/JI-bug_id

 On 05.02.2014 21:58, Robert Krüger wrote:

 I have done that. Could you let me know what its ID is, once it is
 reachable for the public, so I can track it?

 On Wed, Feb 5, 2014 at 4:18 PM, Sergey Bylokhov
 sergey.bylok...@oracle.com wrote:

 Hi, Robert.
 This is unknown issue. Please file a new bug at
 http://bugreport.sun.com/bugreport
 Thanks!


 On 05.02.2014 19:01, Robert Krüger wrote:

 This is a simple test case for you to reproduce the flashing for
 opening a Dialog. It's basically the same for JMenus.

 import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.JOptionPane;
 import javax.swing.UIDefaults;
 import javax.swing.UIManager;
 import javax.swing.UIManager.LookAndFeelInfo;
 import javax.swing.plaf.ColorUIResource;
 import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;

 public class TestDarkNimbus {

   public static void main(String[] args) throws Exception {

   for(LookAndFeelInfo info :
 UIManager.getInstalledLookAndFeels()){
   if(info.getName().startsWith(Nimbus)){
   System.out.println(Setting Look  Feel to  +
 info.getName());
 UIManager.setLookAndFeel(info.getClassName());
   break;
   }
   }

   UIDefaults d = UIManager.getDefaults();
   d.put(control, new ColorUIResource(54, 54, 54));
   d.put(text, new ColorUIResource(214, 214, 214));
   d.put(nimbusBlueGrey, new ColorUIResource(44, 44, 44));
   d.put(nimbusBase, new ColorUIResource(54, 54, 54));
   d.put(nimbusFocus, new Color(71, 85, 101));
   d.put(nimbusLightBackground, new ColorUIResource(54, 54,
 54));
   d.put(nimbusSelectionBackground, new ColorUIResource(51,
 65,
 81));
   d.put(nimbusSelection, new ColorUIResource(51, 65, 81));

   final JFrame frame = new
 JFrame(TestDarkNimbus.class.getSimpleName());
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   JButton button = new JButton(Test Dialog Flashing);
   button.addActionListener(new ActionListener() {
   @Override
   public void actionPerformed(ActionEvent e) {
 JOptionPane.showMessageDialog(frame.getContentPane(),
 Flash , Flash demo,
 JOptionPane.INFORMATION_MESSAGE);
   }
   });
   frame.getContentPane().add(button);
   frame.pack();
   frame.setLocation(500, 500);
   frame.setVisible(true);
   }
 }

 On Mon, Jan 6, 2014 at 6:49 PM, Robert Krüger krue...@lesspain.de
 wrote:

 Hi,

 we are using a customized Nimbus LF (the customization is mostly
 color changes) with dark backgrounds. Since we migrated our product
 from Apple JDK 6 to OpenJDK 8 each JMenu or JDialog opens and first
 draws a white rectangle that is then quickly replaced by the real
 content, which has a rather unprofessional feel.

 Has anyone had a similar problem and maybe a workaround other than
 not
 having a dark background? Is there a known Jira issue I can follow?

 I am currently running build 121 in development on Mac OS 10.8.

 Thanks,

 Robert



 --
 Best regards, Sergey.







Horizontal scrolling in JScrollpad using trackpad

2014-02-26 Thread Robert Krüger
Hi,

the default behaviour for JScrollPane seems to be that a two-finger
drag always only scrolls vertically. This must be something someone
has solved before or is this a limitation/bug of the JDK?

Any hints/pointers anyone could give me? Can this be solved
with/without native code?

Thanks,

Robert


Re: HiDPI/Retina support for -splash option

2014-05-23 Thread Robert Krüger
On Fri, May 23, 2014 at 12:32 PM, Paul Taylor paul_t...@fastmail.fm wrote:
 On 22/05/2014 20:05, Hendrik Schreiber wrote:

 Hi,

 I'm under the impression that the VM option -splash does not honor the @2x
 notation for HiDPI images.
 Am I missing something, is that being worked on, or is there a bug report
 for this (I couldn't find one)?

 It's a little disappointing when you spend so much time on getting Retina
 right and then you realize that the very first impression the user gets when
 starting your app is a bad one, i.e. a blurry splash screen.

 Thanks!

 -hendrik

 But isnt there a much larger problem,  the -splash option still broken only
 to be fixed in https://bugs.openjdk.java.net/browse/JDK-8024185. To clarify
 using the splash option will prevent my main application from working.

Same here.



-- 
Robert Krüger
Managing Partner
Lesspain GmbH  Co. KG

www.lesspain-software.com


Re: java.awt.FileDialog does not work properly bundled but not sandboxed app

2014-05-29 Thread Robert Krüger
Hi,

I am not really sure I understand your posting correctly. Are you
saying that your impression is that java.awt.FileDialog in mode
FileDialog.LOAD does not work properly in an app bundle, regardless of
sandboxing? If that is so, then I can confirm that this is not the
case.

You are not by any chance starting the app with a splash screen with
-splash? If so that is likely to be the reason for your problems as
java.awt.FileDialog is completely broken then (see
https://bugs.openjdk.java.net/browse/JDK-8009203,
https://bugs.openjdk.java.net/browse/JDK-8006420). If I understand the
feedback of an Oracle dev a few days ago on this list correctly, this
is fixed in J9 and will be backported for the next J8 update. We even
implemented our own splash screen because of this.

Cheers,

Robert



On Wed, May 28, 2014 at 8:32 PM, Hendrik Schreiber h...@tagtraum.com wrote:
 On May 23, 2014, at 19:26, Hendrik Schreiber h...@tagtraum.com wrote:
 I'm under the impression that the java.awt.FileDialog in mode 
 FileDialog.LOAD does not work properly when invoked from an app bundle.
 As in: It always assumes a sandbox and does not give me access to all files 
 anymore.
 It does not matter, if the bundle was signed or not.
 The bundle was created with https://bitbucket.org/infinitekind/appbundler
 Note that AppBundler passes in a system property -DSandboxEnabled=true, if 
 it finds *any* Containers folder. Meaning, it's only an indication for 
 whether sandboxing is possible at all, *not* whether this particular app is 
 sandboxed.

 There is no problem, when launching the same app via the regular java 
 launcher.

 Does anybody else have this problem?

 Really, no one else is having problems with this?

 -hendrik



-- 
Robert Krüger
Managing Partner
Lesspain GmbH  Co. KG

www.lesspain-software.com


Re: java.awt.FileDialog does not work properly bundled but not sandboxed app

2014-05-30 Thread Robert Krüger
On Thu, May 29, 2014 at 10:39 PM, Hendrik Schreiber h...@tagtraum.com wrote:
 On May 29, 2014, at 12:27, Robert Krüger krue...@lesspain.de wrote:

 I am not really sure I understand your posting correctly. Are you
 saying that your impression is that java.awt.FileDialog in mode
 FileDialog.LOAD does not work properly in an app bundle, regardless of
 sandboxing? If that is so, then I can confirm that this is not the
 case.

 You are not by any chance starting the app with a splash screen with
 -splash? If so that is likely to be the reason for your problems as
 java.awt.FileDialog is completely broken then (see
 https://bugs.openjdk.java.net/browse/JDK-8009203,
 https://bugs.openjdk.java.net/browse/JDK-8006420). If I understand the
 feedback of an Oracle dev a few days ago on this list correctly, this
 is fixed in J9 and will be backported for the next J8 update. We even
 implemented our own splash screen because of this.

 Thank you, Robert for pointing out the (not quite so obvious) connection 
 between the FileDialog and the splash screen.
 Indeed, I was attempting to use the splash screen option.. once I removed it, 
 things were working as expected.

I know the feeling :-). I ran into this a few months ago and didn't
have a clue what was causing it until a colleague of mine somehow
stumbled over another bug (full-screen mode screwed up by splash
screen, I think) with a similar non-obvious connection.

Cheers,

Robert


Re: 8u40 no dock icon, no menu, weird window behaviour

2015-03-11 Thread Robert Krüger
I just filed mine with a test case. Although it is probably caused by the
same problem I think it's different enough for a separate report.

Anyway, I had submitted it about one minute before your email came.


On Wed, Mar 11, 2015 at 7:37 PM, Mike Murray ashesf...@gmail.com wrote:

 This bug has already been filed:

 https://bugs.openjdk.java.net/browse/JDK-8074669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

 There is a workaround, -Xdebug

 http://stackoverflow.com/questions/28971608/java-jtextfield-entry-broken-on-1-8-0-40-os-x-yosemite-10-10-2

 But this is *very* not good...

 -Michael M


 On Wed, Mar 11, 2015 at 10:24 AM Sergey Bylokhov 
 sergey.bylok...@oracle.com wrote:

 Hi, Robert
 Please file an urgent CR. Add all necessary information to how to
 reproduce the bug. Also please check different osx version(10.9,10.10).

 11.03.15 9:39, Robert Krüger wrote:
  Hi,
 
  after updating to 8u40 our application no longer displays a screen menu
 (we
  use -Dapple.laf.useScreenMenuBar=true), the dock Icon is gone as
 well and
  the Frame pops up behind the IDE window (this is all when starting from
  within Intellij). We are using a modified Nimbus LF, if that is
 important.
 
  What has happend and is there a way to fix this? Going back to 8u25
  everything works. I haven't tested this in an app bundle yet but even
 for
  development alone this would be a serious problem for us.
 
  Thanks,
 
  Robert


 --
 Best regards, Sergey.




-- 
Robert Krüger
Managing Partner
Lesspain GmbH  Co. KG

www.lesspain-software.com


8u40 no dock icon, no menu, weird window behaviour

2015-03-12 Thread Robert Krüger
Hi,

after updating to 8u40 our application no longer displays a screen menu (we
use -Dapple.laf.useScreenMenuBar=true), the dock Icon is gone as well and
the Frame pops up behind the IDE window (this is all when starting from
within Intellij). We are using a modified Nimbus LF, if that is important.

What has happend and is there a way to fix this? Going back to 8u25
everything works. I haven't tested this in an app bundle yet but even for
development alone this would be a serious problem for us.

Thanks,

Robert


Re: Deployment

2015-03-30 Thread Robert Krüger
On Mon, Mar 30, 2015 at 6:06 PM, David DeHaven david.deha...@oracle.com
wrote:


  http://www.jwrapper.com
 
 
  There are alternatives that can be found I came across…
  https://github.com/joshmarinacci/AppBundler

 There's an unofficial fork of AppBundler that's being maintained by (?) at
 BitBucket, those who were involved with the now defunct AppBundler Kenai
 project decided that would be the community maintained fork:
 https://bitbucket.org/infinitekind/appbundler

 Note that AppBundler only supports OSX where Java Packager supports OSX,
 Windows and Linux, and as far as I'm aware the InfiniteKind fork isn't as
 complete wrt OSX packages (I haven't been following activity there for a
 while though). Java Packager is also open source as it's part of OpenJFX,
 community involvement is encouraged.

 Yes, it supports Mac App Store (specifically)

 No, Windows 8 App Store is not supported because (AFAIK) MS requires apps
 be built for WinRT which cannot be done for the JRE at the moment
 (basically a whole new platform which brings a whole host of new issues
 into the mix)


so much for my JFX-cross platform publication plans. Really? I was not
aware of that. Thanks for bringing that to my attention.


Java-based app bundle with minimum os version simply crashes on machine with lower os version

2016-04-08 Thread Robert Krüger
Hi,

I wanted to require a minimum os version for our app bundle and was
disappointed to realize that when I use the LSMinimumSystemVersion key for
that in Info.plist that the behaviour of the application when started on an
OS with a lower version is simply to crash (I tested by making the min
version artificially high, the app normally does run on that machine).
There is an explanatory text in the crash log, should the user choose to
look at it but that is obviously not what I want to have as behaviour of a
commercial application. Do I have any other choice but to program this in
Java now?

Thanks in advance for any hints,

Robert


Re: Setting created timestamp of files using BasicFileAttributeView

2016-03-06 Thread Robert Krüger
sorry, I replied to Scott's mail not using "reply-all" (this ml-setting
sucks bigtime), so you only git half of the information.

On Sun, Mar 6, 2016 at 1:26 PM, Michael Hall <mik3h...@gmail.com> wrote:

> 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> wrote:
>
>> On Mar 5, 2016, at 7:15 AM, Robert Krüger <krue...@lesspain.de> wrote:
>>
>>
>>
>> This…,
>>
>> 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.
>

meaning it only changes last modified and not created.

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).


>
> 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://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
>
> 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
> 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
>

see above. It is supported by just creating a mutable dictionary with the
old values, mofiying the key for created date and then setting those
attributes.


> 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.
>
>
> Robert


Setting created timestamp of files using BasicFileAttributeView

2016-03-05 Thread Robert Krüger
Hi,

could anyone tell me if setting the created time of a file via
BasicFileAttributeView is not supported on OSX? I tried using the following
code snippet:

BasicFileAttributeView attributes =
Files.getFileAttributeView(Paths.get(file.getAbsolutePath()),
BasicFileAttributeView.class);
FileTime time = FileTime.fromMillis(someNewTimeInMillis);
attributes.setTimes(time, time, time);

Finder displays last modified and last opened (i.e. last accessed, I
assume) as the value specified by someNewTimeInMillis but created remains
at the old value.

Is this simply not supported on OSX and I have to use a native call to do
this?

Thanks in advance for any hint.

Robert