Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make runtime loader exception message slightly better #7536

Merged
merged 4 commits into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions wpiutil/src/main/java/edu/wpi/first/util/RuntimeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ public final class RuntimeLoader {
* @return A load error message.
*/
private static String getLoadErrorMessage(String libraryName, UnsatisfiedLinkError ule) {
String jvmLocation = ProcessHandle.current().info().command().orElse("Unknown");
StringBuilder msg = new StringBuilder(512);
msg.append(libraryName)
.append(" could not be loaded from path.\n" + "\tattempted to load for platform ")
.append(CombinedRuntimeLoader.getPlatformPath())
.append("\nLast Load Error: \n")
.append(ule.getMessage())
.append('\n');
.append('\n')
.append(String.format("JVM Location: %s\n", jvmLocation));
if (System.getProperty("os.name").startsWith("Windows")) {
msg.append(
"A common cause of this error is missing the C++ runtime.\n"
+ "Download the latest at https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads\n");
"A common cause of this error is using a JVM with an incorrect MSVC runtime.\n"
+ "Ensure you are using the WPILib JVM (The current running JVM is listed above)\n"
+ "See https://wpilib.org/jvmruntime for more information\n");
}
return msg.toString();
}
Expand Down
Loading