Skip to content

Commit 68f6c19

Browse files
timis1timis1
andauthored
JAVA-18148 Create a new java-nashorn project from the existing langua… (#14268)
* JAVA-18148 Create a new java-nashorn project from the existing language-interop * JAVA-18148 Cleanup the project to contain just the python related language interop --------- Co-authored-by: timis1 <noreplay@yahoo.com>
1 parent 86932cb commit 68f6c19

15 files changed

Lines changed: 89 additions & 4 deletions

File tree

java-nashorn/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Language Interop
2+
3+
This module contains articles about Java interop with other language integrations.
4+
5+
### Relevant Articles:
6+
7+
- [Introduction to Nashorn](http://www.baeldung.com/java-nashorn)

java-nashorn/pom.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<artifactId>java-nashorn</artifactId>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>java-nashorn</name>
9+
10+
<parent>
11+
<groupId>com.baeldung</groupId>
12+
<artifactId>parent-modules</artifactId>
13+
<version>1.0.0-SNAPSHOT</version>
14+
</parent>
15+
16+
<build>
17+
<finalName>java-nashorn</finalName>
18+
<resources>
19+
<resource>
20+
<directory>src/main/resources</directory>
21+
<filtering>true</filtering>
22+
</resource>
23+
<resource>
24+
<directory>src/test/resources</directory>
25+
<filtering>true</filtering>
26+
</resource>
27+
</resources>
28+
</build>
29+
30+
</project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.baeldung.language.interop.python;
2+
3+
import java.util.List;
4+
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
7+
8+
import javax.script.ScriptEngineFactory;
9+
import javax.script.ScriptEngineManager;
10+
11+
public class ScriptEngineManagerUtils {
12+
13+
private static final Logger LOGGER = LoggerFactory.getLogger(ScriptEngineManagerUtils.class);
14+
15+
private ScriptEngineManagerUtils() {
16+
}
17+
18+
public static void listEngines() {
19+
ScriptEngineManager manager = new ScriptEngineManager();
20+
List<ScriptEngineFactory> engines = manager.getEngineFactories();
21+
22+
for (ScriptEngineFactory engine : engines) {
23+
LOGGER.info("Engine name: {}", engine.getEngineName());
24+
LOGGER.info("Version: {}", engine.getEngineVersion());
25+
LOGGER.info("Language: {}", engine.getLanguageName());
26+
27+
LOGGER.info("Short Names:");
28+
for (String names : engine.getNames()) {
29+
LOGGER.info(names);
30+
}
31+
}
32+
}
33+
34+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)