В этой статье
- Reasons for Java was Started but Returned Exit Code=13 Error:
- 4. Exit Codes Above 255
- How to Fix – Java was Started but Returned Exit Code=13 Error in Eclipse
- The Solution for Reason 1:
- The solution for Reason 2:
- The solution for Reason 3:
- Reason 4 Solution:
- 3. Special Exit Codes
- 3.1. General Error: 1
- 3.2. Misuse of Shell Built-in: 2
- 3.3. Cannot Execute: 126
- 3.4. Command Not Found: 127
- 3.5. Invalid Argument To Exit: 128
- 3.6. Fatal Error Signal ‘n‘: 128+n
- 3.7. Exit Status Out of Range: 255
- 5. Conclusion
Reasons for Java was Started but Returned Exit Code=13 Error:
Before going to the solution, let us know why it is showing that error. If you know the problem with this issue, we can easily fix that error.
Reason 1: The most common reason behind this problem is, we are trying to install different bit version-that is 64 bit or 32-bit version of the software. It may be either Eclipse or Java.
Reason 2: Configuration mistake in Eclipse.ini file
Reason 3: Special characters ( #, !, @) in Eclipse installation directory
Reason 4: You may be using latest version of Eclipse, but you might be using wrong version or unsupported version of Java Virtual Machine (JVM)
Reason 5: Issue with your Environment Path Variable
The above are the main reasons causing that Exit code =13 in eclipse. Now let us know how to fix that error.
4. Exit Codes Above 255
Because exit codes are represented by a single byte value, the highest possible exit code is 255. However, nothing prevents us from returning exit codes larger than this. Values over 255 are out of range and get wrapped around.
We should be very careful as this can be a source of unexpected results. For example, the exit code of 383 will be wrapped around and result in an effective exit code of 127, which translates to “command not found”:
$ bash -c “exit 383”
While it’s allowed to return exit values over 255, it’s better to avoid it at all times.
How to Fix – Java was Started but Returned Exit Code=13 Error in Eclipse
The Solution for Reason 1:
Check which version of operating system you are running. To check that, open windows explorer by pressing a Win+E key on your keyboard.
Now on This PC (My Computer) which you found on the left side, Select that and right click on the mouse. In that pop-up menu choose Properties option. When you click that properties option you will see system properties window. In that window have a look on “System Type” option.
In that System type, you will see 64-bit Operating System. That’s what we need to know.
Now we know which version of the operating system we are running.
After knowing operating system version, make sure you downloaded the 64-bit version of Eclipse as well as a 64-bit version of Java software.
If you downloaded 32-bit version (X86) of Java or eclipse any one of them, you will get that Exit code=13 error.
Please double check the versions which you have downloaded. Because during installation it won’t show any error regarding the incompatible version. It will install smoothly.
In my case, I have installed the 32-bit version of Java so I’m getting that error.
The solution for Reason 2:
Maybe you might have made a mistake in configuring Eclipse.ini file, which can be found on Eclipse directory itself. You can check this official guide if needed.
Here the few important rules to be noted while specifying -VM option
- The -vm option and its value (the path) must be on separate lines.
- The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
- The -vm option must occur before the -vmargs option since everything after -vmargs is passed directly to the JVM.
You can check the below screenshot of my working Eclipse.ini configuration.
The solution for Reason 3:
You have might have special characters like #, !, @ in eclipse installation directory. That is, if your eclipse installation address contains any special characters, then it shows that error. So make sure you don’t have any special characters.
Before fixing special character
C:# IDEeclipse 3.7
Have you noticed that “#” character?
After fixing that special character in address
and that solved the problem.
Reason 4 Solution:
Maybe you are using latest eclipse version and unsupported Java version.
To check which version of Java you are using open command prompt by pressing a win+R key and type cmd and press Enter. Now in that console type Java -version command to know java version.
Now research whether Eclipse supports that version or not.
You can open “readme” folder in Eclipse folder and open readme_eclipse.html to see which version it supports.
I recommend you to download both Java and eclipse the latest version.
3. Special Exit Codes
Let’s have a look at some special codes.
3.1. General Error: 1
This is the most used exit code and should be used as a catch-all value for miscellaneous errors.
3.2. Misuse of Shell Built-in: 2
Exit code 2 signifies invalid usage of some shell built-in command. Examples of built-in commands include alias , echo , and printf .
3.3. Cannot Execute: 126
In this case, the command invoked can’t be executed. This will most likely occur when there’s a permission problem or the command isn’t executable.
3.4. Command Not Found: 127
A command couldn’t be found. This may happen, for example, because there was a typo or an issue with our PATH.
3.5. Invalid Argument To Exit: 128
The exit command only takes a positive integer as its argument. This means any negative, fractional, or non-numeric values aren’t allowed.
3.6. Fatal Error Signal ‘n‘: 128+n
In Linux, programs might send one of 33 different signals. When a program terminates after receiving one of these signals, it will return an error code equal to 128 + signal-number.
For example, when we terminate a program by typing Control-C, we’re effectively sending it a SIGINT signal. This signal has a value of 2, therefore, the program will stop its execution and return an exit code with a value 128 + 2 = 130.
3.7. Exit Status Out of Range: 255
Depending on our shell, exit code 255 might mean that the returned exit code is outside of the 0-255 range.
In this article, we’ve learned which exit codes should be treated as reserved and when we can use them in the scripts and programs we write. Some of them we should never use as it would be very confusing for our users.
We have to remember that different shells might have different special exit codes. This is something to be aware of.
Also, when writing programs or scripts, we should document the exit codes we use as a courtesy to our users.