拥有分叉的Java VM意味着什么? [英] What does it mean to have a forked java VM?

查看:383
本文介绍了拥有分叉的Java VM意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我运行JUnit测试时有时会遇到此错误。

I sometimes get this error when I run the JUnit tests.

我并不是在问这个错误是什么。我只是想知道java VM分叉时的含义是什么?

I'm not exactly asking what the error is. I just want to know what it means when the java VM forks?

推荐答案

分叉的虚拟机不是错误(尽管你得到的错误可能与它有关)。

A "forked VM" is not an error (although the error you get may be related to it).

编译和测试的各个方面涉及的一些工具(例如Maven)都是用Java编写的,并使用JVM自行运行。

Some tools that are involved in various aspects of compilation and testing (e.g. Maven) are written in Java and use the JVM to run themselves.

如果为应用程序运行单元测试而不分支VM,Maven将在Maven运行的同一个VM中运行这些测试。因此,它可能会受到某些VM范围设置(例如某些系统属性)的影响。

If you run unit tests for your application without forking the VM, Maven will run those tests within the same VM as Maven is running. Therefore, it may be affected by certain VM-wide settings (e.g. some system properties).

为避免Maven引起的副作用,可以在以下位置运行测试一个分叉的虚拟机,也就是说,在一个完全独立的虚拟机中作为操作系统中的不同进程运行。

To avoid side-effects due to Maven, it's possible to run the tests in a forked VM, that is, in a completely separate VM running as a different process in the OS.

(这可以应用于其他工具,Maven只是一个例子。 )

(This can apply to other tools, Maven is just an example.)

崩溃分叉的VM至少可以让你回到另一个启动并编排这些单元测试的Java应用程序。如果您在同一个VM中运行这些测试,那么您也会使启动测试的应用程序崩溃(从而获得非常少的信息)。

Crashing a forked VM at least allows you to come back to the other Java application that started and orchestrated these unit tests. If you were running these tests within the same VM, you would also crash the application that launched your tests (and thus get very little information in return).

这篇关于拥有分叉的Java VM意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆