使用PowerShell远程运行Java [英] Running Java remotely using PowerShell

查看:188
本文介绍了使用PowerShell远程运行Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在远程会话中运行 PowerShell 时( etsn {servername } ),我有时似乎无法运行Java进程,即使是最简单的:

When I run PowerShell in a remote session (etsn {servername}), I sometimes can't seem to run Java processes, even the most simple:

[chi-queuing]: PS C:\temp> java -cp .\hello.jar Hello
Error occurred during initialization of VM
Could not reserve enough space for object heap

Hello.jar 是一个Hello,world!应该只打印Hello到标准输出

Hello.jar is an "Hello, world!" application that should just print "Hello" to standard output.

所以,问题是,在PowerShell会话的另一端运行进程有什么特别之处吗?有关Java VM如何工作的特殊内容可能不允许这样的处理吗?内存是在远程计算机上分配的,对吧?以下是可用物理内存的读数:

So, the question is, is there something special about running processes on the other side of a PowerShell session? Is there something special about how the Java VM works that might not allow treatment like this? The memory is allocated on the remote computer, right? Here is a readout on the physical memory available:

[chi-queuing]: PS C:\temp> $mem = Get-wmiobject -class Win32_OperatingSystem
[chi-queuing]: PS C:\temp> $mem.FreePhysicalMemory
1013000

但是,当我远程桌面到服务器并询问操作系统有多少可用内存,它说270 MB物理内存免费。让我知道你的想法!

But, when I remote desktop to the server and ask the OS how much free memory there is, it says 270 MB physical memory free. Let me know what you think!

推荐答案

根据这个:
http://msdn.microsoft.com/en-us/library/aa384372(VS.85).aspx

MaxMemoryPerShellMB
指定每个shell分配的最大内存量,包括shell的子进程。默认值为 150 MB

winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1000"}' 

这篇关于使用PowerShell远程运行Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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