https://www.openstm32.org/forumthread8387#form
ENTRY org.eclipse.ui 4 0 2021-02-21 14:00:13.956
MESSAGE Unhandled event loop exception
STACK 0
java.lang.NoClassDefFoundError: org/eclipse/cdt/launch/ui/CMainTab
java.lang.NoSuchMethodException: java.util.prefs.WindowsPreferences.WindowsRegOpenKey(int,[B,int)
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2553)
org.eclipse.cdt.launch_10.3.0.202104111407.jar
CMainTab is removed in the latest Eclipse CDT, the replacement is CMainTab2, but I don't think they are compatible with each other.
However, if we copy CMainTab.class and its sub classes into the latest org.eclipse.cdt.launch
Jar, it works, but is not perfect.
If you know how to fix this, please let me know. I'm not good at Eclipse plugin development.
When you click on the Startup tab, you get a blank page. You will need to click on any other AC6 debug configuration
and then go back to the one you are editing to get the options on that page.
fr.ac6.mcu.externaltools.stlinkserver.win32_1.0.2.201801120948.jar
This module attempts to locate the installed STLink-Server via reading registry, it invokes the internal private function from class WindowsPerspective using hacky reflection. Although this was the common practise since Java 1.6, it is no longer possible to apply the same trick in Java 16 and above, due to the tighten security. I reimplemented this module, it reads the Windows registry by calling a native CLI tool (reg query) and parsing its output. This problem should not exist on Linux.
You can download the patched jar here or compile it from source code by yourself, if you don't trust the binary I supplied.
You may need to create dummy classes for MCUExternalEnvResolver
and MCUExternalToolsPlugin
.
package fr.ac6.mcu.externaltools.stlinkserver.win32;
import fr.ac6.mcu.externaltools.MCUExternalEnvResolver;
import fr.ac6.mcu.externaltools.MCUExternalToolsPlugin;
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class MCUWinExternalEnvResolver extends MCUExternalEnvResolver {
public String getPath() {
String ret = null;
try {
ret = readStringFromLocalMachine("SOFTWARE\\Wow6432Node\\STMicroelectronics\\stlink_server\\InstallDir", "");
if (ret == null) {
ret = readStringFromLocalMachine("SOFTWARE\\STMicroelectronics\\stlink_server\\InstallDir", "");
}
if (ret != null && !(new File(ret)).exists()) {
ret = null;
}
} catch (Exception var3) {
MCUExternalToolsPlugin.log(var3);
ret = null;
}
return ret;
}
public static String readStringFromLocalMachine(String key, String value) throws IOException, InterruptedException {
String ret = null;
boolean useDefault = value == null || value.isEmpty();
String param = useDefault ? " /ve" : " /v " + value;
Process proc = Runtime.getRuntime().exec("reg query HKLM\\" + key + param);
proc.waitFor();
if(proc.exitValue() == 0) {
Scanner sc = new Scanner(proc.getInputStream());
String curLine = "";
// Remove blank lines
do {
curLine = sc.nextLine();
} while(sc.hasNext() && curLine != null && curLine.trim().isEmpty());
// Look for the header
String header = "HKEY_LOCAL_MACHINE\\" + key;
do {
if (curLine.trim().equalsIgnoreCase(header)) {
header = null;
}
curLine = sc.nextLine();
} while(sc.hasNext() && curLine != null && header != null);
if (header == null) {
// Look for the value
do {
String[] splitted = curLine.split("\\s+");
if (splitted.length > 3 && splitted[2].equalsIgnoreCase("REG_SZ")) {
if (useDefault) {
ret = splitted[3];
} else if (splitted[1].equalsIgnoreCase(value)) {
ret = splitted[3];
}
}
curLine = sc.nextLine();
} while(sc.hasNext() && curLine != null && ret == null);
}
sc.close();
}
return ret;
}
}