473,320 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Detect-and-run a method in a Script Host using Java and FESI

Jay
Hi, Everybody:

I have a script host that implemented in Java and using FESI to run
JavaScript. The JavaScript files are separated into different files and
putting together at run or load time. Every time I have to manually to
make sure that a function referenced in one file is defined in another
so my host won't crash due to exception. I have been trying to put in a
detect-and-execute logic in my code for some time but with no real
success. This mainly due to FESI limitation. I believe only JavaScript
1.1 is supported. I have tried eval with try-catch but FESI won't allow
the key word "try" and "catch". I wonder if anybody in this group have
come across the similar problem? Any pointer would be very appreciated.

Thanks,

-Jay

Mar 28 '06 #1
3 1411


Jay wrote:
I have tried eval with try-catch but FESI won't allow
the key word "try" and "catch".


Using
if (typeof someName != 'undefined')
or
if (typeof someName == 'function')
should work even if try/catch is not supported.

And you might consider to switch to the Mozilla Rhino engine instead of
FESI, it is a Java implementation as well but up to date to implement
JavaScript 1.5/ECMAScript edition 3 including try/catch.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Mar 28 '06 #2
Jay
Martin,

Thanks a lot for the pointers. Will let you know my findings.

Thanks again,

-Jay

Mar 28 '06 #3
Jay
Martin,

The typeof worked.
As side note to your response, your suggested code won't escape the
compilier check if it's run under JScript.Net and use MicroSoft VSA
engine as host. I happen to have two engines run side-by-side and one
is worked the other giving compilier error.

The Mozilla Rhino you mentioned sure gives me an option to substitute
the FESI.

Thanks again for your response,

-Jay

Mar 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: new pip | last post by:
In Windows, when I double click on my .py file, the program runs with a console. How can I detect when the console is closed? Any code samples are appreciated. Thank you.
2
by: Denis Perelyubskiy | last post by:
Hello, Is there a way to detect which textarea the cursor is positioned in? I would not want to attach 'onkeypress' to all textareas to detect which one I am presently in ... or is this the only...
4
by: leodippolito | last post by:
Hello, How can I detect the press of CTRL + V in an input of type text? TIA, Leonardo
2
by: Keith Wilby | last post by:
The link below: http://support.microsoft.com/default.aspx?scid=kb;en-us;128814 to the Microsoft KB "Detect Idle Time" article shows how to detect "idle" time. However, if a user is active but...
19
by: lihua | last post by:
Hi, Group! I got one question here: We all know that fclose() must be called after file operations to avoid unexpected errors.But there are really cases when you forget to do that!Just like...
2
by: Roger Maynard | last post by:
Hello List, I have a FileStream which I then read with a BinaryReader. Is there a better way of detecting EOF other than letting it throw an exception??
1
by: David | last post by:
Hi, I want to detect when a hotkey are pressed. I've installed keyboard global hooks, but in dont know how to detect HotKeys. Some Help ? :) Thanks
3
by: Dave | last post by:
If you have multiple buttons on a web form, how can you detect which control was clicked in the Page_Load event Thanks, Dave
7
by: Peter | last post by:
Hello I have an UTF string, how can i detect what language it is? thanks from Peter (cmk128@hotmail.com)
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.