英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论