Summary: | support shebang style java | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Max Rydahl Andersen <manderse> |
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | loskutov |
Version: | 4.15 | Keywords: | helpwanted |
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Max Rydahl Andersen
2019-12-21 11:38:08 EST
That would be cool, yes. For the "#!java --source 11" we could contribute a content describer that "detects" this as "Java" content type, even it is called "*.sh". For the shebang error in file: we probably need to change some parser rules? For running / debugging: I believe as soon as we "know" it is a JavaElement containing "main", we will offer the run/debug possibility. for what it is worth since I opened this issue I created jbang (https://github.com/maxandersen/jbang) and during that i realized you don't actually need the #! style, you can just do: //usr/bin/env java "$0" "$@" ; exit $? import java.util.Arrays; public class script { public static void main(String[] args) { System.out.println("Hello, Java scripts!"); Arrays.stream(args) .forEach(arg -> System.out.println(arg)); } } This is similar to how golang solves it. I would say with that realization it is not really required to support it as its afaik not even part of JLS but just a "quick hack" in the java binary. |