Skip to content

Add --ignore-manifest flag to skip problematic manifest attributes #2441

@maxandersen

Description

@maxandersen

Context

As discussed in PR #2439, JBang now honors more JAR manifest attributes like Enable-Native-Access, Add-Opens, and Add-Exports. This brings JBang closer to java -jar behavior, but also means that broken or incompatible manifest attributes could prevent JARs from running.

Use Case

Users may encounter third-party JARs with:

  • Malformed manifest attributes they cannot fix (closed-source JARs)
  • Attributes that fail validation on newer Java versions but would work on older versions
  • Experimental or non-standard attributes that cause issues

Currently, users have limited workarounds and may be blocked from running otherwise functional JARs.

Proposed Solution

Add a --ignore-manifest flag that allows users to skip specific manifest attributes:

# Ignore a single attribute
jbang --ignore-manifest=Enable-Native-Access run broken.jar

# Ignore multiple attributes
jbang --ignore-manifest=Enable-Native-Access,Add-Opens run broken.jar

Implementation Notes

  • Should work as an escape hatch for any manifest attribute JBang reads
  • Could accept comma-separated list of attribute names
  • Attributes that are ignored should be completely skipped (not passed to JVM)
  • Could potentially add a warning when attributes are ignored

Alternatives Considered

  • Always validate strictly: too restrictive, goes against "make Java easy" philosophy
  • Always pass through without validation: current approach, but no escape hatch for broken JARs

This flag provides the best of both worlds: honor manifest attributes by default, but give users control when needed.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions