Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks
futurecad opened this issue Mar 30, 2024 · 12 comments
Labels
bug Something isn't working working on Work in progress on this issue

Comments

@futurecad
Copy link

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)

@fvarrui
Copy link
Owner

fvarrui commented Mar 30, 2024

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 fvarrui added the bug Something isn't working label Mar 30, 2024
@fvarrui
Copy link
Owner

fvarrui commented Mar 30, 2024

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

private void processStartupScript() throws Exception {
if (this.administratorRequired) {
// We need a helper script ("startup") in this case,
// which invokes the launcher script/ executable with administrator rights.
// TODO: admin script depends on launcher file name 'universalJavaApplicationStub'
// sets startup file
this.executable = new File(macOSFolder, "startup");
// creates startup file to boot java app
VelocityUtils.render("mac/startup.vtl", executable, this);
} else {
File launcher = macConfig.getCustomLauncher();
if (launcher != null && launcher.canRead() && launcher.isFile()){
FileUtils.copyFileToFolder(launcher, macOSFolder);
this.executable = new File(macOSFolder, launcher.getName());
} else {
this.executable = preparePrecompiledStartupStub();
}
}
executable.setExecutable(true, false);
Logger.info("Startup script file created in " + executable.getAbsolutePath());
}

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
Copy link
Owner

fvarrui commented Mar 30, 2024

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 fvarrui added the feedback Waiting for feedback label Mar 30, 2024
@futurecad
Copy link
Author

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)

@fvarrui
Copy link
Owner

fvarrui commented Mar 31, 2024

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?

@futurecad
Copy link
Author

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

@futurecad
Copy link
Author

Are you solving this problem now?

@fvarrui
Copy link
Owner

fvarrui commented Apr 17, 2024

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 fvarrui added working on Work in progress on this issue and removed feedback Waiting for feedback labels Apr 17, 2024
@fvarrui
Copy link
Owner

fvarrui commented Apr 21, 2024

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.

@futurecad
Copy link
Author

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
Copy link
Author

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

@futurecad
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working working on Work in progress on this issue
Projects
None yet
Development

No branches or pull requests

2 participants