尝试运行 java 时的错误消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10324186/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error message in trying to run java
提问by ibexy
Am getting the following error message while trying to run java. I have typed in java -version but am getting error:
尝试运行 java 时收到以下错误消息。我输入了 java -version 但出现错误:
C:\>java -version
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Error occurred during initialization of VM
Could not find agent library jvmhook on the library path, with error: Can't find
dependent libraries
回答by user2909557
Java is being invoked in a slightly abnormal way.
Java 正在以一种稍微不正常的方式被调用。
I have multiple answers depending on your Java version number and whether or not you wish to perform automated testing on your computer.
根据您的 Java 版本号以及您是否希望在您的计算机上执行自动化测试,我有多个答案。
HP's Quick Test Professional (QTP, an automation tool) has been installed on your computer; this is the program which creates _JAVA_OPTIONS(and usually also IBM_JAVA_OPTIONS) to be what you observed in your post:
您的计算机上已安装 HP 的 Quick Test Professional(QTP,一种自动化工具);这是创建_JAVA_OPTIONS(通常还有IBM_JAVA_OPTIONS)的程序,作为您在帖子中观察到的内容:
-Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
QTP puts these in place so that it can recognize Java objects, allowing you test a Java application.
QTP 将这些放在适当的位置,以便它可以识别 Java 对象,从而允许您测试 Java 应用程序。
It also can create environment variable JAVA_TOOL_OPTIONSwith
它也可以创建环境变量 JAVA_TOOL_OPTIONS与
-agentlib:jvmhook
which is required for working with Java 1.6
这是使用 Java 1.6 所必需的
If you do not require QTP to perform tests against Java applications then you can experiment with removing these environment variables. Pro-tip for easy reverting, just amend the Environment Variable names (e.g. rename _JAVA_OPTIONS to IGNOREME_JAVA_OPTIONS) *Environment variables require local admin privileges and a system restart to take affect.
如果您不需要 QTP 对 Java 应用程序执行测试,那么您可以尝试删除这些环境变量。易于恢复的专业提示,只需修改环境变量名称(例如将 _JAVA_OPTIONS 重命名为 IGNOREME_JAVA_OPTIONS) *环境变量需要本地管理员权限和系统重启才能生效。
If you are using Java version 1.5 or older then you can probably get away with removing JAVA_TOOL_OPTIONSonly.
如果您使用的是 Java 1.5 或更早的版本,那么您可能只需删除JAVA_TOOL_OPTIONS 即可。
The jasmine.jar seems to be troublesome to a number of java applications; I have had considerable difficulty with this stopping my applications from running in the past.
jasmine.jar 对一些java 应用程序来说似乎很麻烦;过去,我在阻止我的应用程序运行方面遇到了相当大的困难。
回答by Ernest Friedman-Hill
The _JAVA_OPTIONS
environment variable is making some very serious modifications to your Java environment -- and obviously doing it wrong, since it's not launching. I don't know what is setting that environment variable, but if it's not something you're trying to do yourself, if I were you I'd make a note of the value just in case you need to restore it, then go to your Windows "System" Control Panel and remove _JAVA_OPTIONS
altogether.
该_JAVA_OPTIONS
环境变量进行一些非常严肃的修改您的Java环境-明明做错了它,因为它不是推出。我不知道是什么设置了该环境变量,但是如果这不是您自己尝试做的事情,如果我是您,我会记下该值,以防万一您需要恢复它,然后转到您的 Windows“系统”控制面板并_JAVA_OPTIONS
完全删除。