1
0
Files
frost-zx.github.io/docs/content/temporarily-set-java-path.md
2025-10-13 10:20:34 +08:00

37 lines
873 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "临时设置 Java 环境变量PATH"
date: 2025-03-16T16:09:15Z
lastmod: 2025-03-16T16:10:28Z
tags: [Linux,Windows,命令,命令提示符,Java,终端]
---
# 临时设置 Java 环境变量PATH
适用于 Linux 和 Windows 系统。对于 Linux 系统,可在终端或脚本文件中使用;对于 Windows 系统,可在命令提示符或批处理文件中使用。
---
## Linux
例如设置为 JDK 16
```bash
export JAVA_HOME=/home/jdk/jdk_16
export PATH=$JAVA_HOME/bin:$PATH
```
其中,`/home/jdk/jdk_16` 为使用的 JDK 的安装路径,需要根据实际情况进行修改。
## Windows
例如设置为 JDK 16
```bat
SET JAVA_HOME=C:\Programs\System\Java\jdk_16.0.2
SET PATH=%JAVA_HOME%\bin;%PATH%
```
其中,`C:\Programs\System\Java\jdk_16.0.2` 为使用的 JDK 的安装路径,请需要实际情况进行修改。