JavaScript for executing operations in Java

Source: Internet
Author: User


Use action


Pre-use confirmation must be server2008 64-bit system and the JDK is 64-bit, if 32-bit then it is not possible to use the jar


1. dll in J2v8_win32_x86_64-4.5.0.jar removed and renamed to J2v8_win32_x86_64.dll

2. Place the J2v8_win32_x86_64.dll in the bin directory of the JDK's JRE

3. The above can be done using both


Here is a simple demo


SYSTEM.OUT.PRINTLN (1111); System.out.println ("5jn9vc31snvjejkjgj7aiu6i". Length ()); V8 v8 = v8.createv8runtime (); V8array result = v8.executearrayscript ("Var buffer = new arraybuffer (256); N " + " Var i32 = new int32array (buffer); \ n " + " i32[0] = 1;\n "  +  "i32[1] = 3;\n"  +  "i32[2] = i32[0] + i32[1];\n"  +   "I32;"); Int[] ints = result.getintegers (0, 3); System.out.println ("result: "  + ints[0] +  ", "  + ints[1] +  " ,  " + ints[2"); Result.release ();//v8.release (); V8.executevoidscript ("var abc = .........."); V8array parameters = new v8array (V8);p Arameters.push ("xxxxxxxxxxxxxxxxxx"); String ssss = v8.executestringfunction ("abc",  parameters); System.out.println (SSSS);p arameters.release (); V8.release ();


J2V8 Download





JavaScript for executing operations in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.