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

Is there a way to customize the AppRun? #104

Open
ppazos opened this issue Feb 21, 2024 · 0 comments
Open

Is there a way to customize the AppRun? #104

ppazos opened this issue Feb 21, 2024 · 0 comments

Comments

@ppazos
Copy link

ppazos commented Feb 21, 2024

I'm using electron-builder to generate the AppImage and found this package is used for that.

When running my app with npm start it can find java from the env var JAVA_HOME that is part of my PATH env var.

Though when I execute the AppImage, the PATH that is shown is not the PATH from my env, one thing that doesn't have and it's needed by the app is the JAVA_HOME.

The issue is that java is needed because my app users exec() to execute a CLI that is built on java, os it's executed like $ java -cp app.jar path.to.Main, and from the AppImage I get "java not found".

The other problem is I can't hardcode a path via a .env file, because anyone using the app will have Java installed on different paths, and the standard way to find it is by defining the env var JAVA_HOME and to JAVA_HOME be on the PATH env var.

So maybe somewhere like here

export PATH="${APPDIR}:${APPDIR}/usr/sbin:${PATH}"
could be used to add an extra export JAVA_HOME="${JAVA_HOME}"

Though I don't know if there is any option to do that safely and without the need of extracting and repackaging the AppImage (I would like to configure it and then just build the dist).

While researching I've found this that shows setting the JAVA_HOME in the AppRun (I would prefer something that could be configured): https://gist.github.com/neilcsmith-net/69bcb23bcc6698815438dc4e3df6caa3#file-nb2appimage-sh-L75-L88

Also asked on the electron repo with my findings and data there: electron/electron#41380

I can't find any documentation about this specific issue or examples showing how to customize env vars, so I'm blocked in terms of distributing my app. Any pointers are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant