{"action":"created","issue":{"url":"https://api.github.com/repos/imagej/imagej-ui-swing/issues/73","repository_url":"https://api.github.com/repos/imagej/imagej-ui-swing","labels_url":"https://api.github.com/repos/imagej/imagej-ui-swing/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/imagej/imagej-ui-swing/issues/73/comments","events_url":"https://api.github.com/repos/imagej/imagej-ui-swing/issues/73/events","html_url":"https://github.com/imagej/imagej-ui-swing/issues/73","id":143917401,"number":73,"title":"Bug in the defaut FIJI editor (JavaScript interpreter)","user":{"login":"Bio7","id":281464,"avatar_url":"https://avatars.githubusercontent.com/u/281464?v=3","gravatar_id":"","url":"https://api.github.com/users/Bio7","html_url":"https://github.com/Bio7","followers_url":"https://api.github.com/users/Bio7/followers","following_url":"https://api.github.com/users/Bio7/following{/other_user}","gists_url":"https://api.github.com/users/Bio7/gists{/gist_id}","starred_url":"https://api.github.com/users/Bio7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bio7/subscriptions","organizations_url":"https://api.github.com/users/Bio7/orgs","repos_url":"https://api.github.com/users/Bio7/repos","events_url":"https://api.github.com/users/Bio7/events{/privacy}","received_events_url":"https://api.github.com/users/Bio7/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-28T07:33:29Z","updated_at":"2016-03-28T14:31:37Z","closed_at":"2016-03-28T14:31:37Z","body":"As noted in a [recent discussion in the ImageJ forum](http://forum.imagej.net/t/how-can-i-save-the-log-window-in-javascript/1202/7). There seems to be a bug in the FIJI JavaScript\r\ninterpreter when using the default script editor. \r\n\r\nThe script works in FIJI if you execute the script in the old JavaScript editor (Plugins->New->JavaScript)\r\n\r\nThe following simple script throws an error in the default FIJI script editor:\r\n\r\n```\r\nIJ.log(\"Hello\")\r\nIJ.selectWindow(\"Log\");\r\nIJ.saveAs(\"Text\", \"C:\\Users\\Avital\\Desktop\\Log.txt\");\r\n```\r\nIt seems that the ImageJ classes are not in the classpath of the JavaScript interpreter when using the default editor.\r\n\r\nError message:\r\n`nashorn:mozilla_compat.js:67 ReferenceError: \"IJ\" is not defined`\r\n\r\nThis error was confirmed to be true on Windows 64-bit and on MacOSX."},"comment":{"url":"https://api.github.com/repos/imagej/imagej-ui-swing/issues/comments/202418579","html_url":"https://github.com/imagej/imagej-ui-swing/issues/73#issuecomment-202418579","issue_url":"https://api.github.com/repos/imagej/imagej-ui-swing/issues/73","id":202418579,"user":{"login":"ctrueden","id":556626,"avatar_url":"https://avatars.githubusercontent.com/u/556626?v=3","gravatar_id":"","url":"https://api.github.com/users/ctrueden","html_url":"https://github.com/ctrueden","followers_url":"https://api.github.com/users/ctrueden/followers","following_url":"https://api.github.com/users/ctrueden/following{/other_user}","gists_url":"https://api.github.com/users/ctrueden/gists{/gist_id}","starred_url":"https://api.github.com/users/ctrueden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctrueden/subscriptions","organizations_url":"https://api.github.com/users/ctrueden/orgs","repos_url":"https://api.github.com/users/ctrueden/repos","events_url":"https://api.github.com/users/ctrueden/events{/privacy}","received_events_url":"https://api.github.com/users/ctrueden/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T14:31:37Z","updated_at":"2016-03-28T14:31:37Z","body":"You need to import the `IJ` class first:\r\n```javascript\r\nimportClass(Packages.ij.IJ)\r\n```\r\nSee: http://imagej.net/JavaScript_Scripting#Importing_classes\r\n\r\nIf it still doesn't work after doing that, please reopen the issue."}}