你可以打印正在运行的JAR文件的命令行运行参数。

huangapple go评论52阅读模式
英文:

How can I print the command-line run arguments of a running jar file?

问题

我有一个已经在运行的程序,想知道用来运行JAR文件的命令行参数是什么。我可以通过Java的attach库看到传递给JAR文件的参数,但我想知道正在使用的类路径和其他运行参数是什么。有没有办法以任何方式将这些信息打印到终端?无论是Java代码还是其他方式。

注意:我不是在寻找如何运行带类路径参数的JAR文件,这是我在谷歌上找到的全部信息。

我尝试过VirtualMachine和VirtualMachineDescriptor类,并进行了一些谷歌搜索,但除了在入口点方法中循环遍历字符串数组参数之外,我没有找到其他任何信息,这根本不是我要找的。

英文:

So I have a program that’s already running, and I want to know what command-line arguments are being used to run the jar. I can see the arguments passed to the jar with the java attach library, but I want to know what class path and other run arguments are being used. Is there any way of printing this to the terminal in any way? Java code or otherwise.

Note: I am NOT looking for how to run a jar with classpath arguments, that’s all I’ve been able to find on google

Messed around with the VirtualMachine and VirtualMachineDescriptor classes, did some googling, and didn’t find anything other than looping through the string array parameter in the entry point method, which is not at all what I’m looking for.

答案1

得分: 1

谢谢 tgdavies,procmon learn.microsoft.com/en-us/sysinternals/downloads/procmon 完美运行,直观易用。

英文:

Thank you tgdavies, procmon learn.microsoft.com/en-us/sysinternals/downloads/procmon worked perfectly, was intuitive, and easy to use

huangapple
  • 本文由 发表于 2023年6月13日 07:41:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76460890.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定