Skip to content

Commit 7c2d82c

Browse files
committed
minor changes in nashorn samples
1 parent ca52506 commit 7c2d82c

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

‎res/nashorn3.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ array[2] = 3;
1010
array[3]=2;
1111
array[4]=1;
1212

13-
for(vari=0;i<array.length;i++){
14-
print(array[i]);
15-
}
16-
1713
try{
1814
array[5]=23;
1915
}catch(e){

‎res/nashorn4.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ print(__FILE__, __LINE__, __DIR__);
4646

4747
// java import
4848

49-
varimports=newJavaImporter(java.io);
49+
varimports=newJavaImporter(java.io,java.lang);
5050
with(imports){
5151
varfile=newFile(__FILE__);
52-
print(file.getPath());
52+
System.out.println(file.getAbsolutePath());
53+
// /path/to/my/script.js
5354
}
5455

5556

@@ -68,7 +69,7 @@ print(Object.prototype.toString.call(jsArray));
6869
// convert js array to java array
6970

7071
varjavaArray=Java.to([3,5,7,11],"int[]");
71-
print(javaArray.class);
72+
print(Object.prototype.toString.call(javaArray));
7273

7374

7475
// calling super

0 commit comments

Comments
(0)