Resolving Eclipse "Java was started but returned exit code 13" Error: In-Depth Analysis and Practical Guide

Nov 23, 2025 · Programming · 12 views · 7.8

Keywords: Eclipse | Java | JVM | eclipse.ini | exit code 13

Abstract: This article provides an in-depth exploration of the "Java was started but returned exit code 13" error in Eclipse, covering causes such as Java version incompatibility and 32-bit vs. 64-bit JVM mismatches. It offers detailed steps for configuring the eclipse.ini file, including correct -vm path specification and Java version parameter adjustments. Drawing from multiple real-world cases, the guide helps developers quickly diagnose and resolve startup issues, ensuring a stable development environment.

Error Background and Common Causes

When users uninstall Java 6 and install Java 7 (including both JDK and JRE), Eclipse may fail to start with the error "Java was started but returned exit code 13". This error typically stems from misconfigurations in the Java development environment, primarily involving the following aspects:

In the user case, the initial error was "No JVM found". The user attempted to resolve it by adding a -vm path (e.g., C:\Progra~2\Java\jdk1.7.0_45\bin\javaw.exe) and modifying -Dosgi.requiredJavaVersion=1.7 in the eclipse.ini file, but exit code 13 persisted. This indicates that the path or version configuration might be inaccurate.

Core Solution: Proper Configuration of eclipse.ini File

To resolve this error, the key is to correctly edit the eclipse.ini file, ensuring accurate JVM path and version parameters. Below are steps based on best practices:

  1. Locate and Edit the eclipse.ini File: This file is typically in the Eclipse installation directory. Open it with a text editor, ensuring the file encoding is UTF-8 or system default to avoid parsing errors.
  2. Add or Correct the -vm Parameter: Add a -vm line followed by the path to the JVM executable. The path should point to the javaw.exe in the JDK, not the JRE, to ensure a complete development toolchain. For example:
    -vm
    C:\Program Files\Java\jdk1.7.0_45\jre\bin\javaw.exe
    Note: Use the full path, avoiding abbreviations (e.g., Progra~2), to prevent system recognition issues. The parameter must be placed before -vmargs, typically after lines like --launcher.appendVmargs.
  3. Adjust Java Version Requirements: Check and modify the -Dosgi.requiredJavaVersion parameter to match the installed Java version. For Java 7, set it to -Dosgi.requiredJavaVersion=1.7. This ensures Eclipse validates JVM version compatibility during startup.
  4. Verify Path and Permissions: Confirm that the specified javaw.exe file exists and that the Eclipse process has permission to access it. In Windows, retain spaces in paths, as the system handles them automatically.

Example snippet of an eclipse.ini file:

-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807
-product
adtproduct
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk1.7.0_45\jre\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms40m
-Xmx768m

In this example, the -vm parameter correctly points to the JRE javaw.exe in JDK 7, and the version parameter is updated. Note: Backslashes in paths may need escaping or use of forward slashes in configuration files, but in Windows, backslashes are commonly used directly.

In-Depth Analysis: Error Mechanisms and Prevention Measures

Exit code 13 generally indicates JVM startup failure, potentially due to:

To prevent such errors, it is advisable to:

Supplementary Cases and Alternative Solutions

Beyond the primary solution, other answers provide additional insights:

In practice, combining system logs (e.g., Eclipse error logs) can further diagnose issues. For example, check application logs in Windows Event Viewer for detailed error messages.

Conclusion

The "Java was started but returned exit code 13" error is often caused by improper JVM configuration. By correctly editing the eclipse.ini file with accurate -vm paths and version parameters, it can be effectively resolved. Developers should ensure consistency in Eclipse and JVM versions and architectures, and adhere to parameter order rules. This guide, based on real-world cases, offers a complete workflow from diagnosis to repair, aiding in maintaining a stable development environment. If issues persist, inspect system variables or reinstall compatible components.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.