buffer_indexing_linker.js revision 1565:c779bd47d648
157429Smarkm# buffer indexing linker example 257429Smarkm 357429Smarkm/* 457429Smarkm * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 557429Smarkm * 657429Smarkm * Redistribution and use in source and binary forms, with or without 757429Smarkm * modification, are permitted provided that the following conditions 860573Skris * are met: 965668Skris * 1065668Skris * - Redistributions of source code must retain the above copyright 1165668Skris * notice, this list of conditions and the following disclaimer. 1265668Skris * 1365668Skris * - Redistributions in binary form must reproduce the above copyright 1465668Skris * notice, this list of conditions and the following disclaimer in the 1565668Skris * documentation and/or other materials provided with the distribution. 1660573Skris * 1765668Skris * - Neither the name of Oracle nor the names of its 1865668Skris * contributors may be used to endorse or promote products derived 1965668Skris * from this software without specific prior written permission. 2065668Skris * 2165668Skris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 2265668Skris * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 2365668Skris * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2465668Skris * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 2565668Skris * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 2665668Skris * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 2765668Skris * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 2865668Skris * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 2965668Skris * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 3065668Skris * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 3165668Skris * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3265668Skris */ 3365668Skris 3465668Skris// This script assumes you've built jdk9 or using latest 3565668Skris// jdk9 image and put the 'bin' directory in the PATH 3665668Skris 3765668Skris$EXEC.throwOnError=true 3865668Skris 3965668Skris// compile BufferIndexingLinkerExporter 4057429Smarkm`javac -cp ../../dist/nashorn.jar BufferIndexingLinkerExporter.java` 4157429Smarkm 4257429Smarkm// make a jar file out of pluggable linker 4365668Skris`jar cvf buffer_indexing_linker.jar BufferIndexingLinkerExporter*.class META-INF/` 4457429Smarkm 4557429Smarkm// run a sample script that uses pluggable linker 4657429Smarkm// but make sure classpath points to the pluggable linker jar! 4757429Smarkm 4857429Smarkm`jjs -cp buffer_indexing_linker.jar buffer_index.js` 4957429Smarkmprint($OUT) 5057429Smarkm