I got the Error using javaObjectEDT when I want to use trainlm library

3 Ansichten (letzte 30 Tage)
Hi all,
I need to use the trainlm function. after run the code bellow I got an error
[x, t] = bodyfat_dataset;
net = feedforwardnet(10, 'trainlm');
net = train(net, x, t);
Warning: Invalid file or directory 'C:\Program
Files\MATLAB\R2018b\java\jar\toolbox\nnet.jar'.
> In javaclasspath>local_validate_dynamic_path (line 271)
In javaclasspath>local_javapath (line 187)
In javaclasspath (line 109)
In nnpath.add_jar (line 15)
In nnjava.tools (line 9)
In nntraintool (line 73)
In nnet.train.TrainToolFeedback/startImpl (line 28)
In nnet.train.FeedbackHandler/start (line 18)
In nnet.train.MultiFeedback/startImpl (line 19)
In nnet.train.FeedbackHandler/start (line 18)
In nnet.train.trainNetwork>trainNetworkInMainThread (line 31)
In nnet.train.trainNetwork (line 16)
In trainlm>train_network (line 160)
In trainlm (line 59)
In network/train (line 373)
Error using javaObjectEDT
No class com.mathworks.toolbox.nnet.matlab.nnTools can be located on the Java
class path
Error in nnjava.tools (line 10)
JAVA_TOOLS = javaObjectEDT('com.mathworks.toolbox.nnet.matlab.nnTools');
Error in nntraintool (line 73)
trainTool = nnjava.tools('nntraintool');
Error in nnet.train.TrainToolFeedback/startImpl (line 28)
nntraintool('start',net,data,algorithms,calcSummary,status);
Error in nnet.train.FeedbackHandler/start (line 18)
this.startImpl(useSPMD,data,net,tr,options,status)
Error in nnet.train.MultiFeedback/startImpl (line 19)
this.Handlers{i}.start(useSPMD,data,net,tr,options,status);
Error in nnet.train.FeedbackHandler/start (line 18)
this.startImpl(useSPMD,data,net,tr,options,status)
Error in nnet.train.trainNetwork>trainNetworkInMainThread (line 31)
feedback.start(false,rawData,archNet,worker.tr,calcLib.options,worker.status);
Error in nnet.train.trainNetwork (line 16)
[archNet,tr] =
trainNetworkInMainThread(archNet,rawData,calcLib,calcNet,tr,feedback,localFcns);
Error in trainlm>train_network (line 160)
[archNet,tr] =
nnet.train.trainNetwork(archNet,rawData,calcLib,calcNet,tr,localfunctions);
Error in trainlm (line 59)
[out1,out2] = train_network(varargin{2:end});
Error in network/train (line 373)
[net,tr] = feval(trainFcn,'apply',net,data,calcLib,calcNet,tr);
Do you guys know what is happening? I will appreciate your help
Thanks in advance

Antworten (1)

aditi bagora
aditi bagora am 27 Okt. 2023
Hi Diego,
I understand that you are facing warnings and errors when loading classes in “nnTools" and "nnet.jar". The error suggests that the Java class cannot be found on the Java class path.
To resolve the issue, you can try following approaches:
To resolve the issue, you can try following approaches:
  1. Ensure that the required toolbox or library i.e., “nnet.jar” which provides the “nnTools" class, is correctly installed and is accessible in your MATLAB environment.
  2. Check the spelling of the class name “com.mathworks.toolbox.nnet.matlab.nnTools” to ensure it matches the actual class name. Even a small typo can prevent the class from being located.
  3. If you are using a custom Java class or an external library, make sure it is properly imported and accessible in MATLAB. You may need to add the necessary JAR files or class folders to the Java class path using the “javaaddpath” function in MATLAB.
  4. Restart MATLAB to ensure that any changes to the Java class path take effect.
Please refer to the following link for more information on “javaaddpath”:
Hope this helps and solves your query regarding the error.
Regards,
Aditi

Kategorien

Mehr zu Sequence and Numeric Feature Data Workflows finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by