File tree Expand file tree Collapse file tree 4 files changed +33
-10
lines changed
src/main/java/net/plan99/nodejs/java Expand file tree Collapse file tree 4 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ bintray {
110110 repo = " open-source"
111111 name = " nodejvm"
112112 setLicenses(" Apache-2.0" )
113- vcsUrl = " https://github.com/mikehearn/graviton-browser .git"
113+ vcsUrl = " https://github.com/mikehearn/nodejvm .git"
114114 version.apply {
115115 name = project.version.toString()
116116 desc = " NodeJS interop for GraalVM"
Original file line number Diff line number Diff line change 11import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+ import java.net.URI
23
34plugins {
45 java
@@ -16,11 +17,18 @@ application {
1617
1718repositories {
1819 mavenCentral()
20+ jcenter()
21+ maven {
22+ url = URI (" https://dl.bintray.com/mikehearn/open-source" )
23+ }
1924}
2025
2126dependencies {
2227 implementation(kotlin(" stdlib-jdk8" ))
23- implementation(rootProject) // This would be: implementation("net.plan99.nodejs:nodejs-interop:1.0") in a real project
28+ implementation(rootProject)
29+
30+ // In your programs, you'd write something like:
31+ // implementation("net.plan99:nodejvm:1.1")
2432}
2533
2634configure<JavaPluginConvention > {
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ Download the latest release from the [releases page](https://github.com/mikehear
44
55Now add the ` nodejvm ` directory to your path, or copy the contents to somewhere on your path.
66
7+ Make sure you've got GraalVM and set the location as either ` JAVA_HOME ` or ` GRAALVM_PATH ` . Or make sure
8+ its ` bin ` directory is on your path.
9+
710Start your Java programs as normal but run ` nodejvm ` instead of ` java ` , e.g.
811
912` nodejvm -cp "libs/*.jar" my.main.Class arg1 arg2 `
@@ -25,9 +28,27 @@ gradle build spinners-sample:shadowJar
2528../build/nodejvm/nodejvm -jar build/libs/spinners-sample-*-all.jar
2629```
2730
28- ## From Gradle
31+ ## From your own Gradle projects
32+
33+ Firstly, add my Maven repository for the interop API JAR (this step will become obsolete soon as it'll be in JCenter):
34+
35+ ```
36+ import java.net.URI
37+
38+ repositories {
39+ maven {
40+ url = URI("https://dl.bintray.com/mikehearn/open-source")
41+ }
42+ }
43+
44+ dependencies {
45+ implementation("net.plan99:nodejvm:1.1")
46+ }
47+ ```
48+
49+ (these all use Kotlin DSL syntax)
2950
30- The easiest way is to adjust your JavaCompile tasks to run ` nodejvm ` instead of ` java ` :
51+ Then adjust your JavaCompile tasks to run ` nodejvm ` instead of ` java ` :
3152
3253```
3354tasks.withType<JavaExec> {
Original file line number Diff line number Diff line change 88import org .jetbrains .annotations .NotNull ;
99
1010import java .io .File ;
11- import java .io .FileInputStream ;
1211import java .io .IOException ;
1312import java .io .InputStream ;
1413import java .lang .reflect .InvocationTargetException ;
1514import java .lang .reflect .Method ;
1615import java .lang .reflect .Modifier ;
17- import java .net .JarURLConnection ;
18- import java .net .MalformedURLException ;
1916import java .net .URL ;
2017import java .net .URLClassLoader ;
2118import java .nio .file .Files ;
22- import java .nio .file .Path ;
2319import java .nio .file .Paths ;
2420import java .nio .file .StandardOpenOption ;
2521import java .util .Arrays ;
3430 * Provides an interface to the NodeJS runtime for Java developers. You can only access the NodeJS world
3531 * when running on the event loop thread, which means you must use the various runJS methods on this class
3632 * to get onto the correct thread before using eval.
37- *
38- * @suppress
3933 */
4034@ SuppressWarnings ("WeakerAccess" )
4135public class NodeJS {
You can’t perform that action at this time.
0 commit comments