Jar is not getting executed on MacOS when packaged with electron-packager

人走茶凉 提交于 2021-01-29 05:06:18

问题


Issue Details

**Electron Packager Version:14.2.1

**Electron Version:8.2.5

**Operating System:MacOS 10.14.6 Mojave

Last Known Working Electron Packager version::8.2.5

Expected Behavior

I have created an electron app which will execute a jar file on a specific action in menu bar. I am using nodejs exec(jarfile.jar, callback()) command in the menu action. The jar should get executed and few contents should be written in the local filesystem. This works normally without packaging when I run npm start.

Actual Behavior

I don't see that the Jar is getting executed when I clicked the menu when my app is packaged using electron-packager in MacOs. But works without packaging.

Also it works on Debain.

Code main.js

exec('java -cp myjar-2.0.jar,
            function (error, stdout, stderr) {
                openFile(project_dir, project_name, app.getAppPath(), function () {
                });
            });

package.json

  "name": "mytool",
  "version": "1.0.0",
  "description": "mytool",
  "productName": "mytool",
  "main": "main.js",
  "scripts": {
    "package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
    "create-debian-installer": "electron-installer-debian --src release-builds/mytool-linux-x64/ --arch amd64 --config debian.json"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron": "^8.0.3"
  },
  "dependencies": {
    "deepmerge": "^4.2.2",
    "zip-folder": "^1.0.0"
  },
// I just tried below and it didn't work
  "build": {
    "extraResources": [
      "myjar-2.0.jar"
    ]
  }
}

Please help.

来源:https://stackoverflow.com/questions/61771473/jar-is-not-getting-executed-on-macos-when-packaged-with-electron-packager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!