Skip to content

Fix: Remove legacy Java dependencies in publishFS for MATLAB 2026a#123

Open
matteozanettii wants to merge 1 commit into
UniprJRC:masterfrom
matteozanettii:FixPublishFS
Open

Fix: Remove legacy Java dependencies in publishFS for MATLAB 2026a#123
matteozanettii wants to merge 1 commit into
UniprJRC:masterfrom
matteozanettii:FixPublishFS

Conversation

@matteozanettii

Copy link
Copy Markdown
Contributor

Proposed Changes

Following the recent MATLAB Release Notes announcing the progressive deprecation and removal of internal Java support, the publishFS.m function started to fail. The script previously relied heavily on Java-based engines (XML parsing and XSLT transformations via m2mxdom, xslt, and Transformer) to execute code examples and generate the HTML output. This caused crashes in newer MATLAB environments.

Solution Implemented

To future-proof the toolbox and ensure maximum compatibility, I completely removed the legacy Java dependencies. I have rewritten the HTML generation engine using a 100% native MATLAB approach.

Key Changes

  • Native Code Execution: I replaced the Java-based m2mxdom transformations with MATLAB's native evalc function. This allows the script to cleanly and silently capture the printed output of the examples.
  • Direct Image Handling: I implemented a direct image capture method using findobj('Type', 'figure') and saveas. The script now detects generated plots and embeds them directly into the HTML without relying on XML intermediates.
  • Enhanced Error Handling: I introduced a robust try...catch block during the execution of the examples. If an example fails (e.g., due to a missing dataset in the workspace), publishFS no longer crashes. Instead, it elegantly captures the MException and prints the error message directly inside the generated HTML <pre class="codeoutput"> tag.

Impact

  • Visually, the generated HTML documentation remains completely identical to the previous version.
  • The execution is now faster, more stable, and immune to future MATLAB updates regarding Java deprecation.
  • The tmp file generation and cleanup processes have been streamlined.

Refactor publishFS to use native execution for examples, capturing output and images directly. Remove legacy HTML generation code and streamline the process.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant