当前位置: 动力学知识库 > 问答 > 编程问答 >

Eclipse terminals(TM-Terminals) issue - java is not recoginzed

问题描述:

I m thinking of work with "terminals" from eclipse for my eclipse project.

It seems it works as windows command prompt. But from terminal, I am not able to get the java. I am getting below error while i am trying to type "java" in terminal.

C:\Users\myName>java

'java' is not recognized as an internal or external command,

operable program or batch file.

When I am running same "java" from windows command prompt, it is returning the java values correctly.

what would be the issue in eclipse? Is terminals work as normal command prompt, else need to configure the command prompt in different way in eclipse?

My main purpose, I don't want to use external command prompt while I am working on 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

As I am new to eclipse IDE and terminals, suggest me a solution.

Thanks.

网友答案:

Of which terminal are you talking? Did you install the TM Terminal plugin or something else?

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

网友答案:

If you can use command "java" in windows terminal,you just press F11 to debug or ctrl + F11 to run program without debug.
If you cant use command "java" in windows terminal,check your Environment Variables.

网友答案:

As we can see from output:

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

there is no java on windows PATH...

With current version I have there:

C:\ProgramData\Oracle\Java\javapath

and in this directory there are symlinks:

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
网友答案:

Combining some of the already mentioned solutions you can achieve it as follow.

  1. you define JAVA_HOME and the PATH including it as system variables
  2. you define JAVA_HOME and the PATH including it as environment variable in the same session you start eclipse (for example in a CMD script)
    set JAVA_HOME=...<br> set PATH=%JAVA_HOME%\bin;%PATH%<br> exclipse.exe
  3. you set JAVA_HOME and the PATH including it in the preferences of the terminal
    Window -> Preferences -> Terminal -> Local Terminal -> Variables

other solutions still possible.

分享给朋友:
您可能感兴趣的文章:
随机阅读: