• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to invorke java.exe and javac.exe?

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is java.exe can be invoked without setting the path variable But not javac.exe?


 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.. ?).
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also tell us what you get when you invoke java -version
 
Marshal
Posts: 79466
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79466
379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic