Login  Register

Re: Learning JavaScript [OT]

Posted by David Webster on Aug 10, 2010; 10:33pm
URL: http://imagej.273.s1.nabble.com/Learning-JavaScript-tp3687295p3687298.html

Rob,

My post wasn't OT , as I  was interested in seeing if I could use the ImageJ
and other APIs outside of ImageJ.

And, yes , I am aware that JavaScript and Java are different. I was trying
trying to use the importPackage/importClass feature which is supported by
ImageJ. But as Wayne pointed out, it isn't a feature of Firefox Javascript.

David

On Tue, Aug 10, 2010 at 12:21 PM, Robert Baer <[hidden email]> wrote:

> First, this would not seem to be a proper ImageJ post since it does mpt
> specifically apply to using ImageJ.
>
> That said, my guess is that you do not understand that JavaScript and Java
> are two entirely different languages, albeit with similar syntax.  java.awt
> is a collection of Java 2.0 user interface classes and has little to do with
> the JavaScript engine built into Firefox.
>
> HTH,
>
> Rob
>
> I have been trying to teach myself JavaScript by writing code embedded in
>> html and then loading that in Moszilla Firefox 3.6.8. But, I can't get it
>> to
>> understand importPackage(java.awt). I just get an error message that says
>> "Error: importPackage is not defined". Does anyone know what the problem
>> coud be? The html is included below.
>>
>> David Webster
>>
>> <html>
>> <head>
>>  <title>Run JavaScript File</title>
>> </head>
>> <body>
>>  <h1>Javascript File Test Begin</h1>
>>  <script language="JavaScript" type="text/JavaScript">
>>  importPackage(java.awt);
>>  </script>
>>  <h2>Javascript File Test End</h2>
>> </body>
>> </html>
>>
>>