• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invorke java.exe and javac.exe?

 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is java.exe can be invoked without setting the path variable But not javac.exe?


 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is java.exe can be invoked without setting the path variable But not javac.exe?


That's interesting . Tell us how did you try it and what you got as the output (any error etc.. ?).
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also tell us what you get when you invoke java -version
 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because many computers have a Java™ Runtime Environment (JRE) installed, including java/java.exe, and the PATH is automatically set up to include that JRE. The JRE doesn't include javac/javac.exe.
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, Yes most branded computers (HP etc..) comes with that. Perhaps OP is having one of those.
 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The current path is
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Diskeeper Corporation\Diskeeper\;C:\Program Files\Common Files\DivX Shared\


I installed dk1.6.0_14 tha's all what I did

When typed java the result is

C:\>java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)


When typed javac.exe thr redult

isC:\>javac.exe -versuon
'javac.exe' is not recognized as an internal or external command,
operable program or batch file.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still think it is because there is a JRE somewhere in your PATH; it has obviously been updated to 6u14, which is (I believe) the most recent version.
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Varuna Seneviratna wrote:
I installed dk1.6.0_14 tha's all what I did


Where have you installed your jdk?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15452
42
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably have a java.exe in the C:\Windows\System32 directory. That directory is already in the PATH by default on Windows.

The java.exe in C:\Windows\System32 looks in the Windows registry to see which JRE it should use. It looks at the key \\HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion (you can find it with regedit).

The same does not work with javac.exe - you have to put the directory that contains javac.exe in the PATH yourself.
 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Installation path is:
C:\Program Files\Java\jdk1.6.0_14


Ritchie:
The path variable does not contain a link to a jre.I have pasted the path variable's links.I did by right clicking and going on My Computer-->Properties-->System Variables--->path, then I copied the variable values.If I do the same and copy and past the path values again

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Diskeeper Corporation\Diskeeper\;C:\Program Files\Common Files\DivX Shared\



 
Varuna Seneviratna
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper
HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Runtime Enviorenment\1.6.0_14 in the 1.6.0_14 folder there are three variables I suppose as




Default REG_SZ (value_not_set)
Java_Home REG_SZ C:\program files\java\jre
Micro_Version REG_SZ 0
RuntimeLib REG_SZ C:\Program Files\Java\jre\client\jvm.dll


The system32 contains a java.exe

This is exactly what you told isn't it?
I am not able to dis[lay as it is!
Thanks For your Help!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic