In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to configure JDK and run JAVA under WIN7, which has a certain reference value, and interested friends can refer to it. I hope you can learn a lot after reading this article.
Configure JDK under WIN7, and successfully edit the process of running the JAVA program:
1. I installed jdk-6u22-windows-i586, and the installation path is D:\ Java\
two。 Configuration of environment variables:
(1) JAVA_HOME=D:\ Java\ jdk1.6.0_22; (everyone can change the path according to their own conditions)
(2) PATH=;%JAVA_HOME%\ bin; (be sure to add it after the original PATH path of the system, rather than overwrite it directly, otherwise you may not be able to use CMD. For example: when the variable of the original PATH is C:\ Windows\ system32, add English after "… 32"; "% JAVA_HOME%\ bin;", if there is "… 32" after ";" then just add "% JAVA_HOME%\ bin;". By the way, when the CMD command cannot be used, follow this method and add C:\ Windows\ system32)
(3) classpath=.;%JAVA_HOME%\ lib\ dt.jar;%JAVA_HOME%\ lib\ tools.jar; (need to emphasize: 1. The English ".;" in front of the variable is added to prevent unknown errors; 2. Change the variable to ".;% JAVA_HOME%\ jre\ lib\ rt.jar;%JAVA_HOME%\ lib\ tools.jar", it can still be used as usual, the reason is still unknown to me as a rookie, hope JAVA elder advice.)
At this point, you can run java-version to view the version, and if something similar to java version "1.6.0.22" appears, the installation is successful.
3. Compile entry-level java programs, that is, HelloJava.java that everyone knows!
(1) according to their respective conditions, such as me, even if I create a new JAVAWORK folder on disk E, create a new notepad file in it, and then change the format to java, the system will be prompted to confirm
(2) Open it in notepad, write (or take a direct test-- if you understand the meaning, which is the most important thing), save the following program:
Public class HelloJava {public static void main (String args []) {System.out.println ("ha! finally succeeded!");}}
(3) run cmd and type "javac e:\ JAVAWORK\ HelloJava". If there is no prompt, the class file is created successfully. When you return to this directory, you will see
HelloJava.class file is built
(4) run java HelloJava immediately after that
Did you see the hint? What does that mean? Note that java cannot find the class file we created. Why? Is the environment variable not created? Or that classpath?
First of all, our class file is in a system file that is not in a hard disk or folder with JDK, that is, the path is different; second, directly use java to call the class file, java can not find this guy named HelloJava according to the classpath we set. So, is it okay if we put a guy named HelloJava.class in the path specified by classpath? Let's go back to look at the variables, are specified specific java toolset and library files, real specific files, how to do? Just put it in the lib and try it. Still can't, right? So, can you specify the folder of our current boss named HelloJava.class directly in classpath? Following the above method, add "; E:\ JAVAWORK\;" after the path, exit CMD, refresh, and run java HelloJava again.
Thank you for reading this article carefully. I hope the article "how to configure JDK and run JAVA under WIN7" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.