JDK-8268583 : Java shebang scripts need multiple packages and public classes
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2021-06-09
  • Updated: 2023-10-30
  • Resolved: 2023-10-30
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
A java shebang script starts as a single class, and grows so that it would be reasonable to have multiple packages.
We need a single-file format that would be equivalent to a directory tree, and this format must be human-readable, human-writable, and human-editable.
Something like:

//==Foo.java
package com.foo;
public class Foo {
}
//==Bar.java
package com.foo.bar;
public class Bar {
}

(The full path is not needed because there is a package statement at the top of every source file)

(Note that the full path will be needed if you decide to extend this proposal with support of base64-encoded resource files.)




Comments
Will be implemented by JEP 458.
30-10-2023

RFE to capture the directory structure for multiple packages in a single file so that java shebang can understand and execute it.
11-06-2021