• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Regarding java.exe and javaw.exe

 
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
Last night I was installing a Java Program that asked me to choose a JVM among 3 available.
1. %java_home%\bin\java.exe
2. %java_home%\bin\jre\lib\java.exe
3. C:\Program Files\Java\j2re1.4.1_02\bin\java.exe
My Questions
a) First two of them are from my JDK installation directory. Why JDK installation does need to have two java.exe file. My thought is that, the second one (from JRE) is only for runtime while the first one is for developer. One java.exe could be shared for both purpose though without significance save in space (only 24KB).
b) From when did the third one come? Is it because I installed some other applications with JVM? I am
c) Is javaw.exe(29KB) an optimized version of java.exe for Windows? If yes why should we use java.exe instead?
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a) The two java.exe versions in the JDK install dir both do the same thing. The file is in both places only to prevent you from needing to add both to your path.
b) The third java.exe actually was installed as part of the JDK install as well. The runtime environment in JAVA_HOME/jre is a specially adapted one designed to be used with the JDK. The other one in Program Files is used by tools like the Java PlugIn and the default association for executable JAR files, which are installed as part of the JDK install as well. It's a pure unmodified JRE, not a JDK-specific one.
c) The only difference between java.exe and javaw.exe on the Windows platform is that javaw.exe does not open a console window when it starts. If the application is GUI-based, then that console window often looks awkward and out of place, so javaw.exe is provided to avoid it.
Neither of these is more "optimized" than the other. In fact, they both contain practically identical code. The actual Java VM code is in DLLs that are shared between the two. The differences really lie in certain flags that are set in the Windows EXE format to request, or not request, an attached console.
 
Ashik Uzzaman
Ranch Hand
Posts: 2379
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Chris, thank you very much for the answers to-the-point.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic