JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

After turning on administrator Required, there is no response after entering the password when starting under mac.

Open futurecad opened this issue 1 year ago • 22 comments

I'm submitting a…

  • [ ✅] bug report
  • [ ] feature request
  • [ ] other

Short description of the issue/suggestion:

Steps to reproduce the issue/enhancement:

  1. [First Step]
  2. [Second Step]
  3. [Other Steps...]

What is the expected behavior? After turning on administrator Required, there is no response after entering the password when starting under mac.

What is the current behavior? Turn on administrator Required and then double-click the package program but it cannot run after entering the password.

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

What is the motivation / use case for changing the behavior? I need to start this app as administrator

Please tell us about your environment: macos14.4 jdk21 javapackager1.7.5

  • JavaPackager version:
  • OS version:macos14.4
  • JDK version:21
  • Build tool:
    • [✅ ] Maven
    • [ ] Gradle

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

futurecad avatar Mar 30 '24 14:03 futurecad

Hi @futurecad! I've just try it and managed to reproduce your issue. Not sure why, but it seems that universalJavaApplicationStub script it's not being copied in Contents/MacOS, just the auxiliary script startup, used to run as administrator. I'll try to figure out whats happening asap. Thanks for taking your time posting this issue.

fvarrui avatar Mar 30 '24 15:03 fvarrui

Ok, I've just found where's the bug:

https://github.com/fvarrui/JavaPackager/blob/f01e4f0d5e89e70c3a31181cc1a9aeee445a0919/src/main/java/io/github/fvarrui/javapackager/packagers/MacPackager.java#L123-L150

Some time ago a new feature which let use a custom launcher script was introduced ... creating this side effect. As you can see here, the startup script should be an extension, not an alternative to universalJavaApplicationScript or the custom one.

fvarrui avatar Mar 30 '24 15:03 fvarrui

Just released a SNAPHOT version to Maven Central: 1.7.6-20240330.174335-4. Please, test it and give me some feedback. Thanks!

You can take a look about how to use snapshot versions.

fvarrui avatar Mar 30 '24 17:03 fvarrui

I used 1.7.6 - SNAPSHOT version and still have the same problem. After double-clicking the package to run and entering the password, there is still no prompt. macos version: 14.4.1 (23 E224)

futurecad avatar Mar 31 '24 06:03 futurecad

I used 1.7.6 - SNAPSHOT version and still have the same problem. After double-clicking the package to run and entering the password, there is still no prompt. macos version: 14.4.1 (23 E224)

Ok, I'm not sure what's happening right now.

Please, could you try to run your app from the terminal using $ ./Your.app/Contents/MacOS/startup and universalJavaApplicationStub?

fvarrui avatar Mar 31 '24 10:03 fvarrui

Also doesn't work. How can I show you the relevant logs?

futurecad avatar Apr 01 '24 02:04 futurecad

Are you solving this problem now?

futurecad avatar Apr 17 '24 07:04 futurecad

Hi @futurecad!

Yes, but I haven't found a solution yet. I'll tell you something if figure out what's happening.

You can find some logs in Console.app

fvarrui avatar Apr 17 '24 07:04 fvarrui

Hi @futurecad! Sorry, I can't figure out what's happening since this was working fine some time ago. Let me know if you find a different way than calling osascript to run something as admin on macOS. I'll keep researching about this issue.

fvarrui avatar Apr 21 '24 20:04 fvarrui

1.7.6 - SNAPSHOT Another problem

Null reference [template 'mac/startup.vtl', line 4, column 48]: $SCRIPTPATH cannot be resolved. [DEBUG] ResourceManager: found mac/Info.plist.vtl with loader org.apache.velocity.runtime.resource.loader.FileResourceLoader [DEBUG] Null reference [template 'mac/Info.plist.vtl', line 47, column 33]: $APP_PACKAGE cannot be resolved.

futurecad avatar May 28 '24 06:05 futurecad

I received printouts in my in-application logs but did not successfully start the gui interface.

futurecad avatar May 28 '24 07:05 futurecad

The program can be started normally through startup, but it needs to be set - Djava.awt.headless=false
Launched via app without any logs

futurecad avatar May 28 '24 09:05 futurecad

The program can be started normally through startup, but it needs to be set - Djava.awt.headless=false Launched via app without any logs

Hi @futurecad! Did you find a solution?

fvarrui avatar Jun 30 '24 12:06 fvarrui

The program can be started normally through startup, but it needs to be set - Djava.awt.headless=false Launched via app without any logs

Hi @futurecad! Did you find a solution?

not yet

futurecad avatar Jun 30 '24 12:06 futurecad

Hi, i have same problem. I tried download "issue-398" branch in mavenLocal, but "javapackager" plugin in Gradle doesn`t work. Also i tried SNAPSHOT-1.7.6-20240330.174335-4, but i have same reaction on "isAdministratorRequired = true".

Can you load this in another SNAPSHOT please?

AridanWarlock avatar Aug 30 '24 11:08 AridanWarlock

Hi @futurecad and @AridanWarlock! Sorry, but my availability has been very limited lately and I no longer have a Mac to be able to do tests.

Hi, i have same problem. I tried download "issue-398" branch in mavenLocal, but "javapackager" plugin in Gradle doesn`t work.

Do you mean it cannot be built? Which tool versions are you using?

Also i tried SNAPSHOT-1.7.6-20240330.174335-4, but i have same reaction on "isAdministratorRequired = true". Can you load this in another SNAPSHOT please?

I'm sorry, snapshot versions are not available forever, but just released a new one for this issue: 1.7.6-20240901.181942-1

The program can be started normally through startup, but it needs to be set - Djava.awt.headless=false Launched via app without any logs

I wonder if that the app finally starts with administrator privileges using -Djava.awt.headless=false. If so, you can use vmArgs property to set this argument at runtime by default.

fvarrui avatar Sep 01 '24 18:09 fvarrui

Hi @fvarrui! I set new SNAPSHOT and add -Djava.awt.headless=false. Now I have both scripts created, but still "startup" immediately closes without waiting for the password to be entered.

Снимок экрана 2024-09-04 в 13 51 30

AridanWarlock avatar Sep 04 '24 10:09 AridanWarlock

Hi, @fvarrui! Any ideas what went wrong? What should I try to do?

AridanWarlock avatar Sep 09 '24 13:09 AridanWarlock

Hi, @fvarrui! Any ideas what went wrong? What should I try to do?

Hi @futurecad! Do you know any way to call a script on MacOS as admin without using osascript?

fvarrui avatar Sep 09 '24 16:09 fvarrui

Maybe it would be posible to create a native launcher (for x86 and/or aarch64) which asks for user credentials and runs universalJavaAplicationScript as admin?

fvarrui avatar Sep 09 '24 16:09 fvarrui

@AridanWarlock @fvarrui I couldn't find a better startup solution, so I had to change the program to pop up the user password to temporarily circumvent this problem.

futurecad avatar Sep 10 '24 02:09 futurecad