JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

How to specify parameters to application, not vm args.

Open Ryanznoco opened this issue 1 year ago • 1 comments

I'm submitting a feature request.

I used runnableJar and mainClass parameter of plugin, and I want to specify some parameters to the mainClass, how to ?

  • JavaPackager version: 1.7.5
  • OS version: Windows
  • JDK version: 1.8
  • Build tool: Maven

Ryanznoco avatar Jan 27 '24 11:01 Ryanznoco

Hi @Ryanznoco! Do you want to specify some fixed params? I mean, when you run your app, internaly it uses those fixed params? Or do you want your app to read those params specified when starting your app?

fvarrui avatar Feb 27 '24 19:02 fvarrui

@Ryanznoco ,main函数的参数,建议你在代码里面自行实现

    public static void main(String[] args){
        if (args.length == 0){
            args = new String[]{"arg1","arg2"};
        }
        System.out.println(Arrays.toString(args));
    }

lhDream avatar Mar 28 '24 06:03 lhDream

@Ryanznoco ,main函数的参数,建议你在代码里面自行实现

    public static void main(String[] args){
        if (args.length == 0){
            args = new String[]{"arg1","arg2"};
        }
        System.out.println(Arrays.toString(args));
    }

I think this is the easiest way 👏 👏

@Ryanznoco, if you need help again about this issue, feel free to reopen it

fvarrui avatar Apr 22 '24 14:04 fvarrui