1.注意区分位置
‘java.lang.ClassNotFoundException: com.mathworks.toolbox.javabuilder.internal.MWComponentInstance’。
出现这个问题有可能是你在反射的时候反射的方法没有用对。
在main函数中,使用URLClassLoader可以是
URLClassLoader loader = new URLClassLoader(new URL[]{url});
但是,在不是main函数中,你可要注意了,只能写成
URLClassLoader loader = new URLClassLoader(new URL[]{url},Thread.currentThread().getContextClassLoader());
要不然会报错的。
2.一些解决这个问题的尝试
https://stackoverflow.com/questions/55623861/how-to-fixjava-lang-classnotfoundexception-com-mathworks-toolbox-javabuilder-i
我在StarkOverFlow提了这个问题,有一些我的尝试,如果大家遇到了这个问题,我踩过的坑希望大家就不要踩啦。
参考
https://www.cnblogs.com/wuxinliulei/p/4967101.html
有问题欢迎留言,大家一起探讨。