You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何删除Java 10?React Native开发Java版本降级求助

How to Remove Java 10 and Install Java 8 for React Native Development

Hey there! I’ve been in your exact situation when setting up React Native—Java 8 is a hard requirement for building Android apps with RN, so let’s walk through removing Java 10 properly across different operating systems.

macOS Steps

  • First, confirm your current Java version to make sure you’re targeting the right installation:
    java -version
    
  • Head to the JVM installation directory: /Library/Java/JavaVirtualMachines/
    • You’ll find a folder named something like jdk-10.x.x.jdk—drag this to your Trash, or use the terminal to delete it permanently:
      sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-10*.jdk
      
  • Check for leftover environment variables: Open your shell config file (either ~/.bash_profile, ~/.zshrc, or ~/.profile depending on your shell) and delete any lines that set JAVA_HOME to the Java 10 path.
  • Install Java 8: Grab the official Java 8 JDK installer and follow the on-screen prompts to complete setup.

Windows Steps

  • Open Control Panel > Programs > Programs and Features
  • Locate Java SE Development Kit 10 in the list, right-click it, and select Uninstall
  • Clean up environment variables:
    1. Right-click This PC > Properties > Advanced System Settings > Environment Variables
    2. Under System Variables, find JAVA_HOME—if it points to your Java 10 installation, delete it (you’ll set it to Java 8 later)
    3. In the Path variable, remove any entries that point to Java 10’s bin folder
  • Restart your computer to apply changes, then install Java 8 using the official installer.

Linux (Ubuntu/Debian) Steps

  • List all installed Java versions to confirm Java 10’s presence:
    sudo update-alternatives --list java
    
  • Uninstall Java 10 packages:
    • For OpenJDK:
      sudo apt-get remove openjdk-10-jdk openjdk-10-jre
      
    • For Oracle Java:
      sudo apt-get remove oracle-java10-installer
      
  • Clean up unused dependencies:
    sudo apt-get autoremove
    
  • Install Java 8 and set it as the default:
    sudo apt-get install openjdk-8-jdk openjdk-8-jre
    sudo update-alternatives --config java
    
    When prompted, select the number corresponding to Java 8 to set it as your default version.

Final Check

After installing Java 8, run these commands to confirm everything is set up correctly:

java -version
javac -version

Both should show a version starting with 1.8.x—that means you’re ready to start building React Native Android apps!

内容的提问来源于stack exchange,提问作者Vũ Nguyễn Duy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:05:18