Java 命令提示符中的“wsimport”未被识别错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20920693/
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
'wsimport' is not recognized error in command prompt
提问by Tudor Grigoriu
I am new at web-services. I am trying to generate the stubs using this command:
我是网络服务的新手。我正在尝试使用以下命令生成存根:
wsimport -d ./build -s ./src -p com.ECS.client.jax http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl -b jaxws-custom.xml
I am getting this error in the cmd:
我在 cmd 中收到此错误:
wsimport is not recognized
无法识别 wsimport
My Java environment variable system path is C:\Program Files (x86)\Java\jdk1.7.0
. What am I doing wrong?
我的 Java 环境变量系统路径是C:\Program Files (x86)\Java\jdk1.7.0
. 我究竟做错了什么?
I resolved this issue by using wsimport from netbeans not from cmd...but I still don't know why I couldn't use it from cmd.
我通过使用来自 netbeans 而不是来自 cmd 的 wsimport 解决了这个问题……但我仍然不知道为什么我不能从 cmd 使用它。
采纳答案by baidya
C:\Program Files\Java\jdk1.7.0_60\bin
This is where my jdk is, works for my system:
这是我的 jdk 所在的位置,适用于我的系统:
- Go to My computer >> right click and select properties.
- On the properties tab select Advanced system settings (Windows 7)
- Click enviroment variables
- select path and click edit option
- add
";C:\Program Files\Java\jdk1.7.0_60\bin"
at the end. - Done.
- 转到我的电脑 >> 右键单击并选择属性。
- 在属性选项卡上选择高级系统设置 (Windows 7)
- 单击环境变量
- 选择路径并单击编辑选项
- 添加
";C:\Program Files\Java\jdk1.7.0_60\bin"
在最后。 - 完毕。
回答by Juned Ahsan
wsimport and all other java commands are present in jdk bindirectory and hence you need to update your PATH variable to include:
wsimport 和所有其他 java 命令都存在于 jdk bin目录中,因此您需要更新 PATH 变量以包括:
"C:\Program Files (x86)\Java\jdk1.7.0\bin"
instead of
代替
"C:\Program Files (x86)\Java\jdk1.7.0"
回答by herry
I offer to create JAVA_HOME path. For example my JAVA_HOME:
我提议创建 JAVA_HOME 路径。例如我的 JAVA_HOME:
JAVA_HOME c:\Java\jdk1.6.0_26\
My java path not include any special character and spacing between characters. Windows Path included this:
我的 java 路径不包括任何特殊字符和字符之间的间距。Windows 路径包括:
%JAVA_HOME%\bin;
or:
或者:
c:\Java\jdk1.6.0_26\bin;
Please check your Path. May be included wrong character, another slash, second java path or not included semicolon.
请检查您的路径。可能包含错误的字符、另一个斜杠、第二个 java 路径或不包含分号。
回答by karthik
your java path is not set properly. what you can do is. go to your java bin folder in your cmd prompt like c:\java\jdk.1.7.0\bin and enter your command like wsimport or wsimport -keep -s blahblahblah.
您的 java 路径设置不正确。你能做的是。转到 cmd 提示符中的 java bin 文件夹,例如 c:\java\jdk.1.7.0\bin,然后输入 wsimport 或 wsimport -keep -s blahblahblah 等命令。
This will work!!!
这会奏效!!!
回答by nanosoft
Go to the environment variable. Under system variable choose "PATH" and edit it. In the new dialog box append path till bin folder of jdk. It MUST work.
转到环境变量。在系统变量下选择“PATH”并编辑它。在新的对话框中追加路径直到 jdk 的 bin 文件夹。它必须工作。
回答by Henrique Alho
You can also do this instead of changing the enviroment path variables
您也可以这样做而不是更改环境路径变量
'C:\Program Files\Java\jdk1.8.0_60\bin\wsimport.exe'
And simply execute your code like:
只需执行您的代码,如:
'C:\Program Files\Java\jdk1.8.0_60\bin\wsimport.exe' -d ./build -s ./src -p com.ECS.client.jax http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl -b jaxws-custom.xml
I know this is an old post but I found this solution today and this was the way I solved!
我知道这是一个旧帖子,但我今天找到了这个解决方案,这就是我解决的方法!
回答by andy
If you're on linux and can't find wsimport as a default shell command, you might want to install openjdk-devel.
如果您使用的是 linux 并且找不到 wsimport 作为默认 shell 命令,您可能需要安装 openjdk-devel。
回答by saravanakumar sankar
Actually the problem for this issue is system is not finding the java on the path variable. Eventually the command will work after adding the java on your system path variable..
实际上这个问题的问题是系统没有在路径变量上找到java。最终该命令将在您的系统路径变量上添加 java 后工作..
回答by oren
This is the best solution for this problem:
这是此问题的最佳解决方案:
run on your cmdthis line:
c:>set path=%path%;C:\Program Files\Java\jdk1.8.0_51\bin
在你的cmd这一行上运行:
c:>set path=%path%;C:\Program Files\Java\jdk1.8.0_51\bin
It should work.
它应该工作。
I found it on http://www.skylit.com/javamethods/faqs/javaindos.html
回答by Ajit Kumar Giri
I just delete the entry in path as %JAVA_HOME%\bin
and provide the direct path as C:\Program Files\Java\jdk1.8.0_101\bin
. I don't know why because previously also it was pointing to same directory only.
我只是删除 path as 中的条目%JAVA_HOME%\bin
并提供直接路径 as C:\Program Files\Java\jdk1.8.0_101\bin
。我不知道为什么,因为以前它也只指向同一个目录。