Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure the Java environment using batch processing

2025-03-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to use batch mode to configure Java environment". In daily operation, I believe many people have doubts about how to use batch mode to configure Java environment. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to use batch mode to configure Java environment". Next, please follow the editor to study!

I. demand point

1. The company's on-site maintenance personnel are not proficient in configuring java environment and are easy to mismatch.

two。 Elasticsearch (version 2.3.2) is used in the project, so be sure to configure JAVA_HOME

two。 The project must also be run on jdk8 or above.

II. Solutions

To solve the above problem points, use batch processing to configure environment variables.

The general idea is divided into three steps:

1. Install JDK

two。 Determine which version of jdk is installed on the server. If the version is above 8, it will not be configured.

3. Configure JAVA_HOME and path.

Note:

The batch file needs to be placed in the same directory as jdk, JAVA_HOME / M "% bbd%jdk1.8.0_144", and this path needs to be manually modified to its own JDK path.

@ echo offREM check JDK environment pushd% ~ dp0cd..set bjava=0set "bbd=%cd%" java-version > nul 2 > nulif / I not% errorlevel% = = 0 (set bjava=1goto ENDJAVA) else GOTO CHECKJAVA:CHECKJAVAfor / f "tokens=3"% g in ('java-version 2 ^ > ^ & 1 ^ | findstr / I "version"') do (set JAVAVER=%%g) set JAVAVER=%JAVAVER: "=% for / f" delims=. Tokens=1-3 "% v in ("% JAVAVER% ") do (set CURRENTV=%%w) if% CURRENTV% LSS 8 (set bjava=1): ENDJAVAif% bjava% equ 1 (setx JAVA_HOME / M"% bbd%\ jdk1.8.0_144 "setx Path / M"% JAVA_HOME%%\ bin % PATH% ") pauseecho * echo jdk environment has been configured, please press any key to continue! pause

At this point, the study on "how to configure the Java environment using batch processing" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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: 253

*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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report