Add Java extensions to require.extensions #2

Closed
fb55 opened this Issue Feb 17, 2012 · 1 comment

Comments

Projects
None yet
2 participants

fb55 commented Feb 17, 2012

Great project. I'm loving the idea behind it. Anyway, it would be great if you could add Java extensions such as .class and .jar to require.extensions, so that a simple require("foo.class") would return the whole API of the file.

Support for .java would be a nice-to-have, even when importing it will be pretty slow due to the compilation overhead.

Writing node apps that rely on Java libs would become much easier, and it wouldn't feel as if you try to write Java code in JS. I just want to use the helpers I wrote half a lifetime ago in Java with node, without remembering how Java worked.

joeferner added a commit that referenced this issue Feb 24, 2012

Owner

joeferner commented Feb 24, 2012

Take a look at the syntax here... (https://github.com/nearinfinity/node-java#javaImport).

The problem with using the built-in require is that node looks at the file name first to make sure it exists. In the case of classes embedded in a jar file they would not exist. I also used the name "import" instead of "require" to be more inline with java.

@joeferner joeferner closed this Feb 24, 2012

jimlloyd added a commit that referenced this issue Apr 17, 2015

Update commons-lang3-node-java from commit 8e55fa7.
This build of commons-lang3-node-java.jar was created from
joeferner/commons-lang@8e55fa7

That commit is from
* 8e55fa7 (origin/trunk) Merge pull request #2 from RedSeal-co/feature/better-support-for-varargs-with-overloading.r1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment