필터 지우기
필터 지우기

loading and using a .jar file

조회 수: 18 (최근 30일)
chris hinkle
chris hinkle 2011년 4월 12일
댓글: Abdul-Kareem 2014년 6월 24일
Hello, I have practically no knowledge of using java in matlab.
I have looked around online and all I could find regarding pulling in java into matlab was javaaddpath. I used this command to add the .jar file to my path, and it shows up. What happens next? How do I find out what is in it? How do I use it? Etc.?
Any help? Thanks in advance!

답변 (1개)

Laura Proctor
Laura Proctor 2011년 4월 12일
A good place to start may be Using Sun Java Classes in MATLAB Software in the documentation.
To obtain a listing of all the Java classes that are currently loaded:
[M,X,J] = inmem
The IMPORT function addes a package or class to the current import list:
import pkg_name.* % Import all classes in package
The FIELDNAMES function will return all the public data fields of the object
value = java.lang.Integer(0);
fieldnames(value, '-full')
To see the METHODS of a class, use the methods or METHODSVIEW function:
methodsview java.awt.MenuItem
I hope that this gives you a good starting point! Best of luck.
  댓글 수: 1
Abdul-Kareem
Abdul-Kareem 2014년 6월 24일
Hi. sorry for bumping this but I wanted clarification.
After adding a jar or class or package to the static or dynamic path, what must the package name be when you say: import pkg_name.*
And I don't understand this terminology: methodsview java.awt.MenuItem
How do you go from your jar or class file name to java.awt.MenuItem? How do you find the full names of java files?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Java from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by