gatech-csl / jes

The Jython Environment for Students allows students to write Jython programs that can manipulate pictures, sounds, and videos.
http://mediacomputation.org/
59 stars 38 forks source link

JES doesn't have proper access to the file system on MacOS Catalina #133

Open NicMcPhee opened 3 years ago

NicMcPhee commented 3 years ago

I've just installed JES 6.0 on a MacOS Catalina box. After installing JDK 8 and disabling OpenJDK 14 😒 💔 😒 , JES starts up OK and appears to work.

It fails, however, to display any files in directories such as "Downloads" or "Documents" – I just get a blank file box like there's nothing there (& there are dozens of files and folders there):

Screen Shot 2020-08-11 at 2 05 23 PM

Some folders (like "Dropbox") work, so I think this is a problem where MacOS is "protecting" certain "special" folders like "Downloads" and "Documents". With other applications, MacOS asks "Do you want to give this program permission to access ?", but no such question comes up with JES, perhaps because some error or exception is being swallowed or otherwise ignored?

Looking in the Console there are errors like:

Sandbox: java(87457) System Policy: deny(1) file-read-data /Users/mcphee/Downloads

which support the idea that the OS is blocking these accesses.

Weirdly, if I start it from the command line (./jes.sh) the problem doesn't exist and it can find things in "Downloads" and "Documents". This makes me wonder if the suggestion to "simply disable" new versions of Java actually doesn't completely work. That's a pretty icky workaround for beginning students, especially in a course that's supposed to be friendly for non-computer-nerds. :cry: (& looking at the console, it appears that the same version of Java from the same place is being started whether I double-click the snake or run it from the command line. Not at all clear what the difference might be.)

I tried giving the Java 8 java full disk access, but that didn't fix/change anything, which seems odd.

This sounds like it's perhaps related to #128.

mjguzdial commented 3 years ago

If you have an alternative solution, I’d love to know it. We couldn’t figure one out even after consulting with engineers at Apple.

Sent from my iPhone

On Aug 11, 2020, at 4:11 PM, Nic McPhee notifications@github.com wrote:

 I've just installed JES 6.0 on a MacOS Catalina box. After installing JDK 8 and disabling OpenJDK 14 😒 💔 😒 , JES starts up OK and appears to work.

It fails, however, to display any files in directories such as "Downloads" or "Documents" – I just get a blank file box like there's nothing there (& there are dozens of files and folders there):

Some folders (like "Dropbox") work, so I think this is a problem where MacOS is "protecting" certain "special" folders like "Downloads" and "Documents". With other applications, MacOS asks "Do you want to give this program permission to access ?", but no such question comes up with JES, perhaps because some error or exception is being swallowed or otherwise ignored?

Looking in the Console there are errors like:

Sandbox: java(87457) System Policy: deny(1) file-read-data /Users/mcphee/Downloads which support the idea that the OS is blocking these accesses.

Weirdly, if I start it from the command line (./jes.sh) the problem doesn't exist and it can find things in "Downloads" and "Documents". This makes me wonder if the suggestion to "simply disable" new versions of Java actually doesn't completely work. That's a pretty icky workaround for beginning students, especially in a course that's supposed to be friendly for non-computer-nerds. 😢 (& looking at the console, it appears that the same version of Java from the same place is being started whether I double-click the snake or run it from the command line. Not at all clear what the difference might be.)

I tried giving the Java 8 java full disk access, but that didn't fix/change anything, which seems odd.

This sounds like it's perhaps related to #128.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

NicMcPhee commented 3 years ago

This Apple Developer Forum thread suggests that it's something about the way you bundle the app. You're definitely using JFileChooser like that poster is, so the situation sounds pretty similar.

It looks like you use a script as your main executable, which this thread says "is not a good idea in general, and … can cause exactly this problem", so that seems a likely culprit.

That might also explain why running JES from the CLI doesn't have this access problem, although I'm not really sure why that would be. Maybe if I run it from the CLI it runs as a different user and ends up with different privileges?

mjguzdial commented 3 years ago

I completely concur on what the problem is. We just couldn't figure out a fix. If you do figure out something, I'd love to use it and release a 6.01 for Macs. I'm actively trying to figure out what comes next post-JES to support Media Computation teachers and students.


Mark Guzdial, mjguz@umich.edu

On Wed, Aug 12, 2020 at 10:28 AM Nic McPhee notifications@github.com wrote:

This Apple Developer Forum thread https://developer.apple.com/forums/thread/132986 suggests that it's something about the way you bundle the app. You're definitely using JFileChooser like that poster is, so the situation sounds pretty similar.

It looks like you use a script as your main executable, which this thread says https://developer.apple.com/forums/thread/132986?answerId=420076022#420076022 "is not a good idea in general, and … can cause exactly this problem", so that seems a likely culprit.

That might also explain why running JES from the CLI doesn't have this access problem, although I'm not really sure why that would be. Maybe if I run it from the CLI it runs as a different user and ends up with different privileges?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gatech-csl/jes/issues/133#issuecomment-672905688, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBN7JQO44OXUNVHELFUM4TSAKRJXANCNFSM4P3PTXEQ .

NicMcPhee commented 3 years ago

I've never gotten into modern MacOS app bundling, so I've just stepped off the edge of the map.

There must be people doing this, though, as there are definitely plenty of other apps written in Java. Isn't, for example, Minecraft a Java project?

Rasspyy commented 3 years ago

Has there been a solution to this? I have to download JES 5.02 on my macOS Catalina for my CS Class but it isn't letting me. Please help

mjguzdial commented 3 years ago

To start JES 6.0 on MacOS Catalina, you must open jes.sh. JES 6.0 will work on MacOS Catalina -- see instructions here: https://github.com/gatech-csl/jes/releases/tag/6.0. Nic was asking if we could provide a nice way, double-clicking on a .app file. I've not found a way of doing that, and am currently not working on it.

I don't know how to get JES 5.02 to work on MacOS Catalina. There was a beta version that you can try from here: https://computinged.wordpress.com/2019/07/22/beta-release-of-new-jes-jython-environment-for-students-now-available-media-computation-for-python-ide/


Mark Guzdial, mjguz@umich.edu

On Tue, Aug 18, 2020 at 12:16 AM Rasspyy notifications@github.com wrote:

Has there been a solution to this? I have to download JES 5.02 on my macOS Catalina for my CS Class but it isn't letting me. Please help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gatech-csl/jes/issues/133#issuecomment-675239136, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBN7JWK2RHEU2O33KJJUKTSBH6DPANCNFSM4P3PTXEQ .