Is "Undocumented Secrets of MATLAB Java Programming" by Yair Altman still up to date?
24 views (last 30 days)
Show older comments
I'm considering purchasing this book to get a better understanding of MATLAB's Java library but it was written in 2011.
Does anyone know if MATLAB's Java libraries have changed considerably since 2011?
If they have, what would be the most up to date source of information on this topic?
0 Comments
Accepted Answer
Yair Altman
on 21 Oct 2023
Edited: Yair Altman
on 21 Oct 2023
As of the latest release (R2023b), most of what I posted over the years on the undocumentedmatlab.com website (and in the 2011 book) is still relevant and works just as it had a decade ago, including the undocumented reliance on (and customizations of) the legacy Java-based GUI. The new GUI functionality that has come into focus in recent years (uifigure, App Designer etc.) is based on non-Java technology (HTML & JavaScript). But the legacy Java-based GUI is still functional alongside the HTML/JS-based GUI, at least for now.
MathWorks invested most of its R&D efforts in recent years on the non-Java functionalities, so the Java-based Matlab code has remained largely unchanged so far. My guess is that perhaps 90% of the contents of the 2011 book is still relevant in R2023b, certainly the major concepts. Considering the fact that the undocumented aspects were always under the risk of being "removed without prior notice in a future Matlab relase", the fact that so many of them remained useful for so long (close to 2 decades in some cases) is absolutely amazing in my eyes. It's been a [very] long run, but nothing lasts forever.
Going forward, MathWorks will eventually stop supporting Java-based GUI to some degree (when and to which degree is not publicly known at this time). Note that this phase-out of Java was promised/warned-about for many years already (since 2016 I think), who knows when it will ever happen. Probably not more than a few years though. At that time, it is still unclear whether Java-based GUI customizations will break completely (run-time errors) or exhibit some sort of graceful degradation. AFAIK, MathWorks have so far not made any public comment about either the expected timeline or the behavior. I believe this vagueness is counter-productive, but they have their reasons.
In any case, even if and when the Java phase-out occurs, non-GUI Java-based functionality are expected to still work by loading a user-supplied JRE. As long as you specify a supported JRE and properly configure Matlab to use it, you should be able to keep using non-GUI Java in your Matlab programs, and probably also pure-Java GUI. Note that the interface to using external Java libs is fully documented just like the external interface to Python, C# etc. - there's no undocumented aspect here.
Also note that there are many undocumented aspects of Matlab that are not Java-based - these will probably continue to be relevant even once Java GUI is gone. These include a myriad number of hidden properties and methods of otherwise-documented Matlab objects.
All that being said, and in light of the eventual expected Java phase-out, I do not plan any new edition of my 2011 book "Undocumented Secrets of Matlab-Java Programming". In contrast, I do plan a 2nd edition of my 2015 book "Accelerating Matlab Performance", which is long overdue. But then again, so is MathWorks with its Java phase-out, so I think I'm in good company :-)
0 Comments
More Answers (2)
dpb
on 21 Oct 2023
<Mathworks is abandoning Java>, going forward, <Java will be just another external language>. There's no incentive to go down that route Yair was leading as MATLAB interface will (eventually) not be built around Java at all.
You could still as the second link shows, load JAR files and use Java, but the seamless interface won't be there with internals built upon it. My understanding is that Sun became much more beligerent about licensing issues and Mathworks didn't agree to go along for the ride.
2 Comments
Dyuman Joshi
on 21 Oct 2023
@dpb, would that include java libraries as well? For e.g. the java.math library (which has BigInteger and BigDecimal utilities/functionalities).
dpb
on 21 Oct 2023
As built ins, AFAIU, yes. As the link above states, you can still call Java methods, you'll just have to do so explicitly.
Image Analyst
on 21 Oct 2023
@Yair Altman has a new book out sometime in the past 2 or 3 years.
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!