You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何配置Tanuki Wrapper实现Jar包自定义参数启动?

How to Pass Custom Arguments to a Tanuki Wrapped JAR

Got it, let's get your custom startup arguments working with Tanuki Wrapper. Here's exactly what you need to add and adjust in your configuration:

1. Understand the Parameter Structure

Since you're using org.tanukisoftware.wrapper.WrapperJarApp as the main class, this helper class forwards arguments directly to your application JAR. You’ll use the wrapper.app.parameter.* configuration keys to define these arguments.

2. Update Your Configuration File

Add these lines to your existing Tanuki config (adjust paths and parameters to match your setup):

# First, specify the path to your application JAR (tells WrapperJarApp which JAR to launch)
wrapper.app.parameter.1=/opt/folder/lib/app.jar

# Add your custom arguments one by one, in the exact order you want them passed
wrapper.app.parameter.2=--zk
wrapper.app.parameter.3=localhost:2020
wrapper.app.parameter.4=--uri
wrapper.app.parameter.5=localhost:1919

Key Notes:

  • The numbering for wrapper.app.parameter must be consecutive (start at 1, increment by 1 each time—no gaps allowed).
  • If your app already has default arguments in the config, you can either replace them with these custom ones or append your arguments after the defaults (just adjust the numbering to keep it sequential).

3. Optional: Dynamic Argument Passing (Avoid Hardcoding)

If you want to pass arguments on-the-fly when starting the Wrapper (instead of writing them into the config), do this:

  • Start the Wrapper with the -- flag followed by your custom arguments:
    ./wrapper start -- --zk localhost:2020 --uri localhost:1919
    
  • To make this work, add this line to your config to let the Wrapper forward command-line arguments to your app:
    wrapper.app.parameter.prefix=
    
    (This tells the Wrapper to treat any arguments after -- as application parameters.)

Verify Your Setup

After updating the config, start the Wrapper and check your application logs to confirm the arguments are being passed correctly. You should see the same behavior as running java -jar myapp.jar --zk localhost:2020 --uri localhost:1919 directly.


内容的提问来源于stack exchange,提问作者Bambus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 08:15:13