单独启动tomcat,为什么是调用jdk里面的java.exe?而不是jre里的?
怪我咯
怪我咯 2017-04-17 17:52:08
0
5
563

1,单独启动tomcat,为什么是调用jdk里面的java.exe?而不是jre里的?,
2,单独启动myeclipse调用的却是myeclipse自身自带的的jdk中的javaw.exe,为什么不调用jre中的?
3,为什么tomcat调用java.exe而myeclipse却调用javaw.exe?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(5)
小葫芦

myeclipse also uses jdk but javaw.exe. This executable file is used to compile java into class files.
Tomcat is a class file compiled by calling java.exe to execute myeclipse and calling javaw.exe.

黄舟

Because the environment variable you configure is the path of jdk, if you configure the environment variable, it will not go to jre. If you install jre and configure the environment variable, it will go back to find jre’s java.exe

黄舟
  1. This depends on your configuration. If you only configure JRE, then it will be started using java.exe in JRE.

  2. The functions of java.exe and javaw.exe are the same, except that the java command line program has a standard input and output stream and will print the content to the console. And javaw.exe does not print information.
    So you can also start myeclipse using java.exe, but a black box command line will be displayed on the desktop, and closing the command line will close myeclipse.

  3. This is based on the needs of the program. Tomcat does not have an interface, so it needs a place to display startup information, so naturally java.exe is used. Eclipse has a graphical interface and naturally does not require a command line to display information.

刘奇

Thank you, this is all because of environment variables. The so-called environment variables are where the program looks for the default command.

Looking at your question, I can see that you are using windows. Execute echo %PATH% in cmd,

C:\Users\Administrator>echo %PATH%
C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Python27;C:\Program Files (x86)\Java\jdk1.7.0_17/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;E:\oracle\product.2.0\client_1\bin;E:\adt-bundle-windows-x86-20130917\sdk\platform-tools;C:\Users\Administrator\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft Emulator Manager.0\;C:\Program Files (x86)\nodejs\;D:\programs\TortoiseSVN\bin;D:\programs\apache-maven-3.3.9\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Users\Administrator\AppData\Roaming\Python\Scripts;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Users\Administrator\AppData\Roaming\npm;C:\Program Files (x86)\OpenVPN\bin

If the script that starts tomcat does not specify where java is, then find the first java from the path configured in the PATH, such as the environment variable of my computer above: C:ProgramDataOracleJavajavapath There is a shortcut to java in this directory. jre8, so even if my environment variables include: C:Program Files (x86)Javajdk1.7.0_17/bin, my default java is still jre8's java.

But if the absolute path of the java program is specified in tomcat, then java will not be found in the environment variables, it will be the java you specified.

The above is to answer the question of which java.exe to use. Myeclipse uses javaw.exe because if you directly execute java.exe, a black command line window will appear. This is called the console window. The content of the standard output will be output to this window. , if it is javaw.exe, the console window will not appear and is generally used to run GUI programs.

If anything is inaccurate, please correct me. Please don’t step on me. I am very fragile at heart. Thank you. . .

迷茫

1. It’s because you set the path in the environment variable, which points to the bin directory in the JDK.
2. When calling java.exe, a console will appear. However, MyEclipse has its own interface and does not require a system console to appear. When calling javaw.exe, no console will appear.
3. Tomcat can call both java.exe and javaw.exe. Click Tomcat7.exe to call java.exe and a console will appear. Click Tomcat7w.exe to call javaw.exe, which will have its own interface and no control will appear. tower.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template