Questions tagged [j2v8]

J2V8 is a set of Java bindings for V8. J2V8 focuses on performance and tight integration with V8. It also takes a 'primitive first' approach, meaning that if a value can be accessed as a primitive, then it should be. This forces a more static type system between the JS and Java code, but it also improves the performance since intermediate Objects are not created.

41 questions
2
votes
1 answer

Can I kill JavaScript execution in J2V8?

I've embedded v8 in my Android project via J2V8. This works great, but there are situations where the script hangs (probably due to some kind of endless loop I suppose). The code is way too complicated to debug it and there can always be a situation…
hgoebl
  • 12,637
  • 9
  • 49
  • 72
2
votes
1 answer

Android Javascript Engine; Need to replace WebView with Rhino, J2V8, etc

We are trying to replace our webview and html with a layout file and a javascript engine of some sort. There is a TON of javascript that must be called and we have a rather large JavaScriptInterface that will need to be accessable by the JS engine.…
JGray
  • 293
  • 2
  • 15
1
vote
1 answer

How to detect data changed in js from java with J2V8?

JS code let obj = Native.getObj(); obj.width = 100; kotlin code val native = Native() val nativeV8Obj = V8Object(v8) nativeV8Obj.registerJavaMethod(native, "getObj", "getObj", emptyArray()) v8.add("Native", nativeV8Obj) nativeV8Obj.close() class…
boybeak
  • 417
  • 5
  • 19
1
vote
2 answers

How to pass ByteArray as parameter to function using J2V8

I am attempting to use the J2V8 library on Android to call a javascript function and pass a parameter to it. The below code is what I have, but can't figure out how to pass the bytes ByteArray to the called function. private fun…
pnizzle
  • 6,243
  • 4
  • 52
  • 81
1
vote
1 answer

J2V8 for Android, context methods

I'm using J2V8 port for Android (https://github.com/eclipsesource/J2V8). Is it possible to enable context methods (setInterval, setTimeout, ..)? V8 runtime = V8.createV8Runtime("global"); runtime.executeIntegerScript("setInterval(function() {…
Zalexei
  • 93
  • 2
  • 10
1
vote
1 answer

j2v8: creating new instance of binded object

Our teams is currently under consideration of which JavaScript Engine Bridge to use. We are choosing between LiquidCore and J2V8. My question is concerning j2v8. Supposedly, I have to create several instances of some java class in JavaScript, how…
Nickolay M.
  • 140
  • 3
  • 9
1
vote
0 answers

J2V8 J8Object marshal to/from Json

I am using the NodeJS interface of the J2V8 project to create a scripting sandbox inside of an Akka actor (written in Scala with the spray.json.JsObject libraries from Akka-Http). I have json coast-to-coast design for the architecture. I have JSON…
Tim Panagos
  • 55
  • 1
  • 7
1
vote
1 answer

J2V8 ReferenceError : process is not defined, when trying to execute script

I'm using J2V8 to call a javascript function from my Java code. When I try to execute my script it gives me ReferenceError : process is not defined. The script uses reactDomServer to transform a hash map into an html object. I'm initializing my V8…
user2018726
  • 638
  • 2
  • 12
  • 23
1
vote
1 answer

Embedding j2v8 library in neo4j and reuse of the V8 runtime

I need to embed j2v8-4.6.0 library (bindings for JavaScript engine, V8) for use in neo4j-community-3.1.0 (graph database management system) user-defined functions. So, code of my simple plugin: package js; import org.neo4j.procedure.*; import…
stdob--
  • 28,222
  • 5
  • 58
  • 73
1
vote
0 answers

Is there a prebuilt env.js that can be used with the v8 engine in Java?

I've been working on a Java app which uses Javascript to render handlebars HTML templates. I had been using Rhino in Java as the js engine, and then moved to use the Nashorn js engine. I'd like to try using V8, via the J2V8 wrapper library. However,…
1
vote
1 answer

Embed node.js application from java project with J2V8 - resolving relative paths in node.js

Having problem while running Node.js application (1) on the JVM using J2V8 from another Java-based application (2). Starting script of application (1) fails on line fs.readFileSync('./lib/someFile.json') because J2V8 provides '.' path to an…
1
vote
1 answer

How can I debug J2V8/node.js when running within JVM?

Typically, I use node inspector (https://github.com/node-inspector/node-inspector) to debug node.js. Can this be used to attach to a remote node.js instance running in the JVM via J2V8? Also, it looks like the dev version of node.js supports native…
aim4min
  • 81
  • 2
0
votes
0 answers

Using J2V8 on Android, how should I get the function handle of JS

I try to use optype.js in android, there is a function like this: opentype.Font.prototype.stringToGlyphIndexes = function (s, options) { .... return bidi.getTextGlyphs(s); }; i don't know how to call it in Java. I try to call it using…
Jackor
  • 1
0
votes
0 answers

How to get complete error stacktrace in J2V8?

webgl-demo/game34.js: , TypeError: Cannot set properties of undefined (setting 'width') With registering a Console obj, the error method only shows less info. The crash line number is not shown. So, how to get the completely js error stacktrace?
boybeak
  • 417
  • 5
  • 19
0
votes
0 answers

Object not defined error when using d3.js with J2V8

Tried to use the D3 logics / algorithm in android using J2V8 For example V8 runtime = V8.createV8Runtime(); Object obj = runtime.executeScript(readFileAsString("d3-array.v1.js")); Integer maxObject =…
Aravinth
  • 1
  • 1