- Launch command prompt as Administrator, then execute the javac command.
- Install makesqr package in another folder where normal users have a permission to write
Create a Java Package with MATLAB Code Error
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kevin Chng
am 4 Sep. 2018
Kommentiert: ABHISHEK BHARDWAJ
am 18 Okt. 2019
I follow the following example:
In this step,
Compile the Java application using javac.
javac -classpath "mcrroot\toolbox\javabuilder\jar\javabuilder.jar";.\makesqr.jar .\getmagic.java
The cmd prompted the error :
.\getmagic.java:4: error: error while writing getmagic: C:\Program Files\makesqr\application\getmagic.class class getmagic ^ 1 error
0 Kommentare
Akzeptierte Antwort
Kojiro Saito
am 5 Sep. 2018
This is due to file access permissions. In my case, I got the following error.
C:\Program Files\makesqr\application>javac -classpath "C:\MATLAB\MATLAB_Runtime\v94\toolbox\javabuilder\jar\javabuilder.jar";.\makesqr.jar .\getmagic.java
.\getmagic.java:4: error: error while writing getmagic: .\getmagic.class (Access is denied)
class getmagic
^
1 error
javac tries to create getmagic.class file, but normal users do not have a permission to write a file under C:\Program Files.
I think there are two options.
6 Kommentare
Kojiro Saito
am 18 Okt. 2019
The class file version is 55.0, so I guess you have compiled getmagic.java by Java 11.
JVM in MATLAB R2018a (MATLAB Runtime v94) is Java 1.8.0_144, so you need to do javac by Java 8.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Java Package Integration finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!