简体   繁体   English

在NetBeans中导出变量的运行时值

[英]Export runtime value of a variable in NetBeans

I'm using NetBeans for Java programming and I want to export the value of a variable into a file, since I can't do it by copy and paste like a big array list. 我正在使用NetBeans进行Java编程,我想将变量的值导出到文件中,因为我无法像大型数组列表那样通过复制和粘贴来做到这一点。 Is there any command to do this at runtime? 在运行时是否有任何命令可以执行此操作?

You can dump heap with tools like jmap (part of jdk). 您可以使用jmap类的jmap (jdk的一部分)转储堆。 To have a snapshot of your application memory. 拥有应用程序内存的快照。

But I don't think there's a way to "paste" values on NetBeans for the fields/variables. 但是我认为没有办法在NetBeans上“粘贴”字段/变量的值。 You can go and change them manually. 您可以手动更改它们。 But what if the current array have 4 elements and the one you saved have 9? 但是,如果当前数组有4个元素,而保存的数组有9个元素怎么办? How will be the object references? 对象将如何引用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM