Eclipse终端(TM-Terminals)问题 - java没有被识别

时间:2016-01-26 07:29:19

标签: java eclipse

我正在考虑使用eclipse中的“终端”来完成我的eclipse项目。 它似乎作为Windows命令提示符。但是从终端,我无法获得java。当我尝试在终端中键入“java”时,我遇到了错误。

C:\Users\myName>java
'java' is not recognized as an internal or external command,
operable program or batch file.

当我从Windows命令提示符运行相同的“java”时,它正确地返回java值。

eclipse会出现什么问题?终端是否像普通的命令提示一样工作,否则需要在eclipse中以不同的方式配置命令提示符?

我的主要目的是,当我在eclipse IDE上工作时,我不想使用外部命令提示符。

Environment variable details:
PATH: C:\Program Files\Java\jdk1.7.0_79\bin
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_79\bin

Eclipse.ini File:
-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m

set p output in terminals:PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3d04
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Dell\DW WLAN Card;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW
S\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files\WIDCOMM\Bluetooth Software\;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel
\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Program Files (x
86)\CloudFoundry;C:\Users\myName\AppData\Roaming\npm\node_modules;C:\Users\myName\AppData\Roaming\npm;C:\Users\myName\AppData\Local\atom\bin;C:\Program Fil
es\Git\bin
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files

set p from windows command prompt:
Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Dell\DW WLAN Card;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files\WIDCOMM\Bluetooth Software\;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Program Files (x86)\CloudFoundry;C:\Users\Gopalan\AppData\Roaming\npm\node_modules;C:\Users\Gopalan\AppData\Roaming\npm;C:\Users\Gopalan\AppData\Local\atom\bin;C:\Program Files\Git\bin;C:\Program Files\Java\jdk1.7.0_79\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3d04
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public

由于我是eclipse IDE和终端的新手,建议我一个解决方案。 感谢。

4 个答案:

答案 0 :(得分:1)

结合一些已经提到的解决方案,您可以按照以下方式实现。

  1. 您定义JAVA_HOMEPATH将其包含为系统变量
  2. 您在启动eclipse的同一会话中定义JAVA_HOMEPATH包含它作为环境变量(例如在CMD脚本中)
    set JAVA_HOME=...<br> set PATH=%JAVA_HOME%\bin;%PATH%<br> exclipse.exe
  3. 您在终端的偏好设置中设置了JAVA_HOMEPATH Window -> Preferences -> Terminal -> Local Terminal -> Variables
  4. 其他解决方案仍有可能。

答案 1 :(得分:0)

你在说哪个终端?您是否安装了TM Terminal插件或其他内容?

https://marketplace.eclipse.org/content/tm-terminal

答案 2 :(得分:0)

如果你可以在windows终端中使用命令“java”,你只需按F11进行调试或按ctrl + F11运行程序而无需调试。
如果您无法在Windows终端中使用命令“java”,请检查环境变量

答案 3 :(得分:0)

正如我们从输出中看到的那样:

Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files\Dell\DW WLAN Card;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW
S\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files\WIDCOMM\Bluetooth Software\;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel
\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Program Files (x
86)\CloudFoundry;C:\Users\myName\AppData\Roaming\npm\node_modules;C:\Users\myName\AppData\Roaming\npm;C:\Users\myName\AppData\Local\atom\bin;C:\Program Fil
es\Git\bin

Windows PATH上没有java ...

目前的版本我在那里:

C:\ProgramData\Oracle\Java\javapath

并且在此目录中有符号链接:

C:\ProgramData\Oracle\Java\javapath>dir
 Volume in drive C is Windows
 Volume Serial Number is 3873-EE18

 Directory of C:\ProgramData\Oracle\Java\javapath

2015-11-02  16:07    <DIR>          .
2015-11-02  16:07    <DIR>          ..
2015-11-02  16:07    <SYMLINK>      java.exe [C:\Program Files (x86)\Java\jre1.8.0_65\bin\java.exe]
2015-11-02  16:07    <SYMLINK>      javaw.exe [C:\Program Files (x86)\Java\jre1.8.0_65\bin\javaw.exe]
2015-11-02  16:07    <SYMLINK>      javaws.exe [C:\Program Files (x86)\Java\jre1.8.0_65\bin\javaws.exe]
               3 File(s)              0 bytes
               2 Dir(s)   2,630,152,192 bytes free