feat: add support for java code execution

As of Java 11 a single file can be launched without explicitly
compiling, packaging and running the file in different steps.
In other words single-file source-code programs can be executed
with "java Program.java", where "Program.java" is the name of
the file to be executed.
This commit is contained in:
Mahmoud Fathi
2022-09-04 21:55:19 +02:00
committed by Maas Lalani
parent 0572aaac99
commit ebc2ab70bf
2 changed files with 17 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ Currently supported languages:
* `ruby`
* `perl`
* `rust`
* `java`
<!-- * `secret` -->
---
@@ -105,3 +106,14 @@ fn main() {
println!("Hello, world!");
}
```
---
### Java
```java
public class Main {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
```

View File

@@ -25,6 +25,7 @@ const (
Python = "python"
Ruby = "ruby"
Rust = "rust"
Java = "java"
)
// Languages is a map of supported languages with their extensions and commands
@@ -71,4 +72,8 @@ var Languages = map[string]Language{
{"<path>/<name>.run"},
},
},
Java: {
Extension: "java",
Commands: cmds{{"java", "<file>"}},
},
}