Javac.exe terminated with code 2, but cannot be built.

Asked 2 years ago, Updated 2 years ago, 67 views

I created the "Hello world" app to develop Android with Visual Studio 2015(VS)+Xamarin, but when I built it, I got the error "Javac.exe ended with code 2" and I couldn't build it.

After some research, I found that there was space in the Java path, so I uninstalled Java once, moved from C:\program files (x86)\Java\jdk to C:\Java\jdk, changed the environment variables, and passed the path of Xamarin's JDK in VS, but it didn't improve.

Please let me know if there is any way to correct this error.

The following are the specifications.
Operating System: Windows 10 Home (64bit)
VS 2015
JRE:ver1.8.0_231 Java HotSpot(TM) Client VM (build 25.231-b11, mixed mode, sharing)
JDK:javac13.0.1

I look forward to your kind cooperation.

java visual-studio

2022-09-30 19:35

1 Answers

JDK(13.0.1) and JRE(1.8.0) were installed in different folders at the same time (C:\Java\jdk and C:\Java\jre), but after integrating into Java 8, at least the problem was resolved.

This post is based on @user37155's commentsI posted it as Munity wiki.


2022-09-30 19:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.