Access java from javascript in firefox
Hi,
I am trying to access java method from javascript.
It works fine with ie, but firefox somehow brings up the error
saying the method defined in java is not a function.
I am calling like.
document.applets["myapp"].soundAlarm();
I have put MAYSCRIPT in the applet tag.
still not works.
Does anyone have idea ?
Thanks
Try with
document.myapp.soundAlarm();I assume that the name attribute of the APPLET is myapp.
Note the MAYSCRIPT is useless in your context. MAYSCRIPT is used when from Java you need to access the JSObject.
See http://www.rgagnon.com/topics/java-js.html for examples.
Bye.
Similar Messages
-
How can I decode Japanese character using java from JavaScript escape() function
Hi:
I have an application which supports Japanese character. I am using JavaScript escape() function to encode the text field before I posted it through web server and then I will just convert it into hex number to decode it through an Integer. It works fine for the character between ascii 1-255. However, it faild on all the double bytes character. All the unicode has the format of "%uXXXX" after it is escaped from JavaScript. How can I resolve the decoding problem?
Thank,
DavidPlease use 'encodeURI()', though it is supported only IE after 5.5.
I'm not sure Netscape.
Thanks,
Katsumi
dwang <[email protected]> wrote:
Hi:
I have an application which supports Japanese character. I am using JavaScript
escape() function to encode the text field before I posted it through
web server and then I will just convert it into hex number to decode
it through an Integer. It works fine for the character between ascii
1-255. However, it faild on all the double bytes character. All the
unicode has the format of "%uXXXX" after it is escaped from JavaScript.
How can I resolve the decoding problem?
Thank,
David -
Accessing HTMLB from javascript
Hi expert,
Can someone explain how to access the attributes,methods avialable in javascript to access htmlb objects in a page,
Like for e.g.,
htmlbSL(this,2,'SUBMITVALUES:HandleSubmit')
Is there any document available?
Thank you
APHi AP,
I believe there is no documentation avaliable about this.
Maybe because this accessing method is not right to do
but I can explaint about the function htmlbSL
function htmlbEL(this,2,'SUBMITVALUES:HandleSubmit');
this = HTML element.
2 = event type index.
SUBMITVALUES:HandleSubmit = objectID:eventName
if you want to know list of event type index.
here the list:
<b>EVENT TYPE INDEX</b>
'htmlb:breadCrumb:click' 1
<b>'htmlb:button:click' 2</b>
'htmlb:checkbox:click' 3
'htmlb:image:click' 4
'htmlb:link:click' 5
'htmlb:radioButton:click' 6
'htmlb:tabStrip:click' 7
'htmlb:tree:click' 8
hope this can help you.
respeck,
-adyt- -
How do I import and access bookmarks from my laptop firefox
nowhere do I see bookmarks on android Firefox
If Sync worked, you should see bookmarks when you tap the Awesomebar (address bar). The typical display is 3 tabs: Top Sites, Bookmarks, History. Can you find them there?
-
Can I access servlet from javascript
Hello everybody,
I am trying to write on servlet in which first user add name and two Date
[ fromDate and toDate] for this i used javascript Calendor control which show me
the date calendor.
Now i want to send request to server for checking date different when user click on
day of that fromDate Calendor.
How can i send request ? As using submit button it possible to send request.
but using tht Calendor [JavaScript ] control How i submit request or is
any javascript code i have to add ?
waiting for reply,
Thanks,
NilHi razoredge,
thank for reply,You right request go to server when i click on submit button.
I want that action when user click in day of fromDate Calendor object [javascript].
this show one calendor control and user select day,
when user select day that window close and selected date display on textbox,
I want after close that popup window,request goes to that submit request directly instead of
user has to click on submit button,
Can this work ?
Thanks
Nil -
Access javabean from javascript
Hi all,
I have learned this code to generate a progress bar using javascript. However, whithin javascript, I can only simulate a constant time for the progress bar.
In my web page, when the user click submit....a logic takes place in the back end for sometimes to finish. How do I tight that logic to my javascript to retrieve real time?
Thank you very much for your time and assistanceYou have to call code on the server.
See here for an example using Perl. You can use any server-side tech you want.
http://www.ipwebdesign.net/kaelisSpace/useful_serverClientValidation.html -
Accessing JFX from Java or find a workarround
Hi there, I'm a new one ...
I'm working on this project designing applications for a touch panel. I've written a little Java app that uses JNA to access the driver and grab the coordinates of touches on the panel. Works fine so far ...
Now I'm creating an UI using Java FX. I've got the thing up and running, only experiencing minor problems due to learning JFX.
When it comes to combining the UI with the Java classes that access the driver I'm not sure how to implement the whole thing. I know it's only possible to access Java from JFX, not the other way arround. My java classes though are the ones who should trigger the events the UI should react to.
I think I've read something about the possiblity to use reflection to call JFX functions from Java which is one idea I could go with. (if anyone got good links ...)
The other idea is that I implement a sort of FIFO object where my Java classes drop events and a timer in my JFX classes where I pull them out (not sure if MediaTimer is the right class to go with)
Any suggestions, tips, etc. ? :)
Greetings, AlexI think that if you create a interface in java and a class in javafx that implements that interface you can then pass that class to java. For instance:
Java:
public interface EventReceiver {
public void receive(String event);
// Then your java class that generates the events
public class EventGenerator {
private List<EventReceiver> receivers = new LinkedList<EventReceiver>();
public void registerEventReceiver(EventReceiver er) {
receiver.add(er);
public void unregisterEventReceiver(EventReceiver er) {
receiver.remove(er);
* Add code that calls EventReceiver.receive(String) method for each element in the receiver list
* when the panel is touched.
}and in the JavaFX code:
public class JavaFXEventReceiver extends EventReceiver {
public override function receive(String event) {
// Do UI updates...
}A little more indepth version can be found here:
http://www.compare-review-information.com/pure-java-code-to-call-javafx-class/
You might run into some problems though pertaining to threading...but there are workarounds for that aswell :)
- Emil H -
Accessing COM from Java using JCOM
When I tried to access a simple COM component with the com2java generated files,
I got the following error. Can someone help me with this?
<Nov 8, 2001 3:37:24 PM CST> <Error> <HTTP> <[WebAppServletContext(366665,Defaul
tWebApp,/DefaultWebApp)] Servlet failed with IOException
AutomationException: 0x80070005 - General access denied error
at com.bea.jcom.bm.b(bm.java)
at com.bea.jcom.Rpc.a(Rpc.java)
at com.bea.jcom.bf.a(bf.java)
at com.bea.jcom.Dispatch.createDispatch(Dispatch.java)
at com.bea.jcom.Dispatch.<init>(Dispatch.java)
at com.ak.jcomtest._JComTestProxy.<init>(_JComTestProxy.java:33)
at com.ak.jcomtest.JComTest.<init>(JComTest.java:105)
at com.ak.jcomtest.JComTest.<init>(JComTest.java:77)
at jsp_servlet.__jcom._jspService(__jcom.java:91)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2456)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>I did everything earlier except the second point you mentioned. Everything started
working as soon as I added a line to call com.bea.jcom.AuthInfo.setDefault() method.
I didn't think this was necessary since I already gave permissions to that user
using DCOMCNFG. Thanks for you help.
"BEA jCOM Support" <[email protected]> wrote:
>
Your jcom.log indicates you are trying to access the COM object with
Authentication
"BXDOMAIN/akumar". Add this user to the default access/launch permissions
(using
DCOMCNFG) on the machine hosting the COM object.
Also, make sure you put this in your Java code:
com.bea.jcom.AuthInfo.setDefault("BXDOMAIN", "akumar", "<password>");
"Anil Kumar" <[email protected]> wrote:
Here's the log
jCOM checkconfig 6.1 Beta - Copyright (C) 2001 BEA Systems, Inc. Copyright
(C)
1999-2001 Linar Ltd. and Intrinsyc Software, Inc. http://www.bea.com/jcom/
--- Checking OS ---
Microsoft Windows NT 5.0 (Build: 2195) Service Pack 2
--- Checking Time ---
Time: 15:20:49
Date: 11/13/01
--- opening typelib: JComTestProject.exe ---
Class Name = JComTest
Class Id = 742db055-77df-404a-a579-e0cbfd3007a7
Class Name = JComTestProject.JComTest
AppID = {742DB055-77DF-404A-A579-E0CBFD3007A7}
{742DB055-77DF-404A-A579-E0CBFD3007A7} = JComTestProject.JComTest
Implemented Categories = no value(259)
{40FC6ED5-2438-11CF-A3DB-080036F12502} = no value(259)
LocalServer32 = D:\Program Files\Microsoft Visual Studio\VB98\Projects\JCom\JComTestProject.exe
("D:\Program Files\Microsoft Visual Studio\VB98\Projects\JCom\JComTestProject.exe"
file exists)
ProgID = JComTestProject.JComTest
Programmable = no value(259)
TypeLib = {E0BF28D6-6347-4017-8D2E-52B145CE47DA}
VERSION = 2.0
--- Checking Username ---
USER:WARANGAL\akumar
GROUP:WARANGAL\None
GROUP:\Everyone
ALIAS:WARANGAL\ORA_DBA
ALIAS:BUILTIN\Administrators
ALIAS:BUILTIN\Users
ALIAS:BUILTIN\Power Users
GROUP:\LOCAL
GROUP:NT AUTHORITY\INTERACTIVE
GROUP:NT AUTHORITY\Authenticated Users
--- Checking DCOM settings ---
DCOM version supports accessing Java from COM
EnableDCOM = Y
DefaultLaunchPermission:
Access enabled for NT AUTHORITY\SYSTEM
Access enabled for NT AUTHORITY\INTERACTIVE
Access enabled for BUILTIN\Administrators
--- Connecting to SCM ---
Connecting to SCM on localhost
Connect successful
--- IP configuration ---
Hostname = warangal.bxsys.com
Address 0 = 172.18.32.102
Connecting to SCM on 172.18.32.102
Connect successful
Address 1 = 169.254.25.129
Connecting to SCM on 169.254.25.129
Connect successful
--- Winsock Information ---
Version: 202
Description: WinSock 2.0
--- Environment Variables ---
ALLUSERSPROFILE=C:\WINNT\Profiles\All Users
APPDATA=C:\WINNT\Profiles\anil\Application Data
BOOKSHELF=D:\ifor\WIN\BIN\EN_US
CLASSPATH=.;d:\mystuff\javastuff\jarz;d:\weblogic\lib\weblogic510sp6boot.jar;d:/jdk122/javamail112/mail.jar;d:/jdk122/jaf-1.0.1/activation.jar;d:/jdk122/jsdk2.1/server.jar;d:/jdk122/jsdk2.1/servlet.jar;D:\WebLogicCommerceServer3.2\classes;D:\Oracle\Ora81\jdbc\lib\classes111.zip;D:\weblogic\lib\WebLogic_RDBMS.jar;D:\Oracle\Ora81\orb\classes\yoj.jar;D:\Oracle\Ora81\orb\classes\share.zip
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=WARANGAL
ComSpec=C:\WINNT\system32\cmd.exe
HELP=D:\IBMVJava3.0\eab\;D:\IBMVJava20\eab\;D:\ifor\WIN\BIN
HOMEDRIVE=C:
HOMEPATH=\
I4_INSTALL_DRIVE=D:
I4_LANG=EN_US
IPF_PATH32=D:\ifor\WIN\BIN\EN_US
J2EE_CLASSPATH=D:\j2ee121\lib\cloudscape\cloudspace.jar;
JAVA_HOME=d:\jdk13
LOGONSERVER=\\WARANGAL
NLSPATH=D:\ifor\LS\MSG\%L\%N
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Os2LibPath=C:\WINNT\system32\os2\dll;
Path=d:\jdk13\bin;D:\Oracle\Ora81\bin;D:\Oracle\Ora81\orb\bin;C:\WINNT;C:\WINNT\system32;C:\WINNT\system32\WBEM;d:\jdk13\bin;D:\CVS;D:\ifor\WIN\BIN;D:\ifor\WIN\BIN\EN_US;D:\JavaStuff\jakarta-ant-1.3\bin;D:\BEA\wlserver6.1\jcom\bin;D:\WebGain\VisualCafe\Java2\Bin;C:\Program
Files\Common Files\WebGain Shared;D:\WebGain\VisualCafe\Bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0803
ProgramFiles=C:\Program Files
PROMPT=$P$G
StarTeam=D:\StarTeam 4.0\StarTeam.ini
StarTeamApp=D:\StarTeam 4.0
STLicense=D:\StarTeam 4.0
SystemDrive=C:
SystemRoot=C:\WINNT
TEMP=D:\TEMP
TMP=D:\TEMP
USERDOMAIN=WARANGAL
USERNAME=akumar
USERPROFILE=C:\WINNT\Profiles\anil
windir=C:\WINNT
WorkstationID=D:\StarTeam 4.0\ConnectionManager.ini
"Damon Hon" <[email protected]> wrote:
hi anil,
can you run the checkconfig tool as well
checkconfig /typelib <path to tlb> config.log
and post the log
thanks
damon
"Anil Kumar" <[email protected]> wrote in message
news:[email protected]...
Hi Damon,
I am just calling the default constructor of the com2Java generatedclass(in this
case, it is JComTest.class) from a simple JSP. I am not calling anymethods on
this component. Here are the contents of the log file.
jCOM version 6.1 Beta logger started in immediate mode at Tue Nov
13
12:32:41
CST 2001 at level 3 (VERBOSE)
License:
Classloader is bootstrap
java.version is 1.3.1
java.vendor is Sun Microsystems Inc.
java.class.path is..;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;D:\BEA\wlserver6.1\jcom\lib\jcom.
jar;D:\Projects\JCom\src
java.library.path isD:\BEA\jdk131\bin;.;C:\WINNT\System32;C:\WINNT;.\bin;d:\jdk13\bin;D:\Oracle\
Ora81\bin;D:\Oracle\Ora81\orb\bin;C:\WINNT;C:\WINNT\system32;C:\WINNT\system
32\WBEM;d:\jdk13\bin;D:\CVS;D:\ifor\WIN\BIN;D:\ifor\WIN\BIN\EN_US;D:\JavaStu
ff\jakarta-ant-1.3\bin;D:\BEA\wlserver6.1\jcom\bin;D:\WebGain\VisualCafe\Jav
a2\Bin;C:\Program
Files\Common Files\WebGain Shared;D:\WebGain\VisualCafe\Bin;
os.name/os.arch/os.version is Windows 2000/x86/5.0
1005676361251 +: New RemOxidResolver initialised for Net={{ 0x7,127.0.0.1[135]}}
Sec={}
1005676361271 +: Looking for free connection handler to 127.0.0.1[135]for
BXDOMAIN/akumar
1005676361311 : OXID Resolver started. Listening on port 3895
1005676361321 : Object Exporter binding is Net={{ 0x7,172.18.32.102[3896]},
{ 0x7, 169.254.25.129[3896]}} Sec={{ 0xa, 0xffff, }, { 0x0, 0x0,
OXID
is 1005676361311
1005676361331 +: Opening a TCP/IP connection to 127.0.0.1[135] withauth
BXDOMAIN/akumar
1005676361361 : Sending RemoteActivation request to Net={{ 0x7,127.0.0.1[135]}}
Sec={} to activate cls/iid742db055-77df-404a-a579-e0cbfd3007a7/fbcd1246-3557-4b95-8046-cfec093310b5
1005676361832 : Sending IRemoteActivation::RemoteActivation request,with
RPC
call id 2 on ipid null
1005676361892 : Received the response toIRemoteActivation::RemoteActivation
request, with RPC call id 2
1005676361902 +: Remote server's version: 5.1
1005676361942 *: Error activating742db055-77df-404a-a579-e0cbfd3007a7/fbcd1246-3557-4b95-8046-cfec093310b5:
AutomationException: 0x80070005 - General access denied error
"Damon Hon" <[email protected]> wrote:
hi anil,
can you post the snippet of java code that is calling the methods
from your COM object and post the following logs
jcom.log
- In your java code, add the following line to the start of your
initialization code.
com.bea.jcom.Log.logImmediately(3, "c:\\temp\\jcom.log");
config.log
- Run the checkconfig utility to generate this log
checkconfig /typelib <path to tlb> config.log
thanks
damon
"Anil Kumar" <[email protected]> wrote in message
news:[email protected]...
Thanks for the info. I had already done this before. I checked
everything
a dozen
times. I am not sure why this is happening. Please let me know,
if
there
are any
other ideas.
"Damon Hon" <[email protected]> wrote:
hi anil,
The exception you are getting, indicates that your java client
does
not
have
sufficient permissions to access your com component.
if you are running your java code and com component on the same
machine,
- make sure that your jcom/bin directory is in your path environment
variable
- run the DCOMCNFG tool to configure accesss for the interactiveuser
or the
user you are logged in as.
if you are not running your java code under windows, add this
call
in
your
java code:
com.bea.jcom.AuthInfo.setDefault("nt domain", "user", "password");
- use the DCOMCNFG tool to configure has dcom access to the
com
component for this user
let me know if this helps
damon
"Anil Kumar" <[email protected]> wrote in message
news:[email protected]...
When I tried to access a simple COM component with the com2java
generated
files,
I got the following error. Can someone help me with this?
<Nov 8, 2001 3:37:24 PM CST> <Error> <HTTP><[WebAppServletContext(366665,Defaul
tWebApp,/DefaultWebApp)] Servlet failed with IOException
AutomationException: 0x80070005 - General access denied error
at com.bea.jcom.bm.b(bm.java)
at com.bea.jcom.Rpc.a(Rpc.java)
at com.bea.jcom.bf.a(bf.java)
at com.bea.jcom.Dispatch.createDispatch(Dispatch.java)
at com.bea.jcom.Dispatch.<init>(Dispatch.java)
at
com.ak.jcomtest._JComTestProxy.<init>(_JComTestProxy.java:33)
at com.ak.jcomtest.JComTest.<init>(JComTest.java:105)
at com.ak.jcomtest.JComTest.<init>(JComTest.java:77)
at jsp_servlet.__jcom._jspService(__jcom.java:91)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:265)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:200)
atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:2456)
atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2039)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
> -
Access page item from Javascript
I have searched the forum, and based on my findings this is what I've done so far:
I have a page item where the Google Map key is stored. I want to access it from Javascript so that I can call the Google map with the key. (Note: The key can't be hardcoded as it will be pulled from DB according to the environment/url the app is running on. e.g. - dev, test, production.)
Here's a javascript code block:
<script>
var google_key = $x('P1_GOOGLE_KEY').value;
var l_url = "http://maps.google.com/maps?file=api&v=2&key=" +
google_key +
"&sensor=false";
</script>I have tried, $v('P1_GOOGLE_KEY') , $x('P1_GOOGLE_KEY') , &P1_GOOGLE_KEY. and none of them work.
How do I access a page item from Javascript?
Thx!
MarcMarc,
I am going to take a shot in the dark, but are you referencing this item outside of a function in your head tag? So basically it tries to reference the item on load? If so this is not going to work because the item does not exist yet. If you are using jQuery change your code to look like:
$(document).ready(function(){
var google_key = $x('P1_GOOGLE_KEY').value;
var l_url = "http://maps.google.com/maps?file=api&v=2&key=" +
google_key +
"&sensor=false";
});This will tell the javascript to fire after everything has fully loaded. If you are not using jQuery then you can use a little javascript snippet from here to add a ready event to your page. or you can copy paste this into a script tag.
(function () {
var ie = !!(window.attachEvent && !window.opera);
var wk = /webkit\/(\d+)/i.test(navigator.userAgent) && (RegExp.$1 < 525);
var fn = [];
var run = function () { for (var i = 0; i < fn.length; i++) fn(); };
var d = document;
d.ready = function (f) {
if (!ie && !wk && d.addEventListener)
return d.addEventListener('DOMContentLoaded', f, false);
if (fn.push(f) > 1) return;
if (ie)
(function () {
try { d.documentElement.doScroll('left'); run(); }
catch (err) { setTimeout(arguments.callee, 0); }
else if (wk)
var t = setInterval(function () {
if (/^(loaded|complete)$/.test(d.readyState))
clearInterval(t), run();
}, 0);
document.ready(function (){
var google_key = $x('P1_GOOGLE_KEY').value;
var l_url = "http://maps.google.com/maps?file=api&v=2&key=" +
google_key +
"&sensor=false";
Good Luck,
Tyson Jouglet -
Okay, so I did the whole
<cfinvoke component="myCFC" method="init"
returnvariable="myObj">
Now is it at all possible to access this from
JavaScript?it's no different than any other CF code.
you can do:
<script type="text/javascript">
var myVariable = "#myObj.foo()#";
</script>
(assuming the foo() method returns a string... and that the
code is within <cfoutput> blocks)
but whether it's a CFC or any other CF code, you still have
the client side (JS) / server side (CF) issues. -
(how) can I access Java APIs from web-page-hosted JavaScript?
Can I access Java APIs from a web-page via JavaScript if I have a JRE installed on the client machine? And if so, how?
Thanks in advance for your time and consideration.John L. wrote:
Can I access Java APIs from a web-page via JavaScript if I have a JRE installed on the client machine? And if so, how?As far as I can remember that was actually possible in the very first versions of Netscape because Netscape really wanted to pretend Javascript and Java were meant to be used together. But they soon removed that functionality. Can you guess why?
Because people were using the File/IO classes to easily steal or remove files on the harddrive, among other such niceties. You do NOT want to have such control from a web application. People will abuse it. -
Accessing java objects from within javascript
Hello,
Anyone with an idea of a useful toolkit for accessing java objects from within javascript will be much appreciated.
Thanks in advance,
Antana.What do you mean by accessing Java objects? Do you mean interacting with an applet via JavaScript? Something else?
-
Accessing java classes from javascript
Hi,
I have the following javascript function
function testjava {
var myString = new java.lang.String("Hello world"); // line 1
alert("len:"+myString.length()); // line 2
}It gives me a error at line 1 saying "'java' is undefined" in IE browser 5.5 sp2. But, both the lines execute correctly in netscape 6.
Can someone please help..
Thanks,
Vijay.It seems that IE 5.5 doesn't support accessing java classes in JavaScript, so try to install IE 6 to see if it works or maybe, you doesn't have installed propertly support for JVM in IE.
-
Access Java object from Javascript
Hi
I'm trying to invoke a Java object from Javascript (scriptengine and all that).
I want to add scripting features to a GeneXus Java generated app... and I have very basic skills on java too. Sorry for that ;o).
This is the java code to pass "params" to the scriptengine:
engine.put("remoteHandle",remoteHandle);
engine.put("context", context); The remoteHandle (int) and context (com.genexus.ModelContext) pass trough all the gx-java generated programs.
This javascript works fine:
importClass(Packages.uftestjs);
new uftestjs(remoteHandle).execute( ) ;The remoteHandle conversion is ok (javascript-number to int). The context is optional.
But if I want to pass context:
importClass(Packages.uftestjs);
new uftestjs(remoteHandle, context).execute( ) ;Fails with this:
"javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: Java constructor for 'uftestjs' with arguments 'number,javax.script.SimpleScriptContext' not found."
Obviously, no conversion is possible with context (javax.script.SimpleScriptContext to com.genexus.ModelContext).
There is some way to reference de original context, by the object Id??? or something like that???
Thanks in advance for any replies!!!
Greetings from Chile. (I hope you can understand my english!)Hi
Well, since this topic is about java programming I think the place is right here.
(I use some tricks to embed java statements in genexus objects...)
I will try to get some help at Artech (GX) on how to build something... to get the conversion needed.
But they are not focussed on support this kind of questions.
Anyway, I want to know: do I can to reference an object by the objId?
I want to code something like this:
com.genexus.ModelContext context =
(com.genexus.ModelContex)getTheObjectFromTheJVM(theObjectId);(powered by google translator, ha!) -
How to run Java from Firefox Extension using liveconnect?!
Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from around the net to get where I am now. I'm sure I'm just making some stupid error at some step.
In order to work out what I'm misunderstanding/doing wrong I'd be really grateful if someone could show me how to get it to work using a very basic example:
Say I have a .java file taken from the sun pages:
* The HelloWorldApp class implements an application that
* simply displays "Hello World!" to the standard output.
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); //Display the string.
}So I stick it into a jar using:
jar.exe cvfe HelloWorldApp.jar HelloWorldApp.class HelloWorldApp.class
I then place it directly on my C: drive.
In the javascript of my firefox extension I have code copied and pasted from https://developer.mozilla.org/en/Java_in_Firefox_Extensions:
var urlClasz = java.lang.Class.forName("java.net.URL");
var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1);
urlArray[0] = new java.net.URL('file:///C:/HelloWorldApp.jar');
var cl = java.net.URLClassLoader.newInstance(urlArray);
var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
var aStaticMethod = aClass.getMethod("HelloWorldApp", []);
var greeting = aStaticMethod.invoke(null, []);This seems to start java but then only gives me the error:
"Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.ClassNotFoundException: HelloWorldApp]."
I would be infinitely grateful if someone could show me the code I would use in this situation to run the HelloWorldApp. If I could get it working in this basic situation I'm sure I could work it out from there.
Thank you very, very much!!By the way, I answered just because nobody did and I have some experience with using java from mozilla javascript.
But I never played with Firefox extensions.
No problem baftos, I understand you might not have all the answers but you've helped loads so far, so thanks a lot! I've found it very difficult to find good documentation on this for a beginner like me.
Adding public did it (although I thought that I'd tried that, oops) so thanks again for that. I may have a couple of other questions just in case you happen to know the answer!
I'd like to send some string arguments to the method I really want to run eg:
public class HelloWorldApp {
public static void sayHello(String[] args)
{code}After googling .forName and .getMethod to see how to pass parameters I've added some code:
{code:java}
var strClass = java.lang.Class.forName("java.lang.String");
var parameters = java.lang.reflect.Array.newInstance(strClass,2);
parameters[0] ="My string argument";
parameters[1] ="3"; // etc...
var argHolder = java.lang.reflect.Array.newInstance(strClass,1);
argHolder[0] = strClass;
var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
var aStaticMethod = aClass.getMethod("sayHello", argHolder);
var greeting = aStaticMethod.invoke(null, parameters);
{code}What I thought I was doing was creating a java array: argHolder and putting the string class/object thingy?! in it so that getMethod would look for a method called "sayHello" which took a string array as an argument... but apparently not!
This brings me back to square one with a cannot find method with these arguments error:
"Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.IllegalArgumentException: No method found matching name getMethod and arguments [java.lang.String, [Ljava.lang.String;]]."
You don't happen to know how to do this as well do you?!
Edited by: mzatanoskas on Feb 13, 2009 1:40 PM
Maybe you are looking for
-
Monitoring access ports with DFM
Hello, I need to monitor access port for utilization and high broadcasts and errors on Catalyst switch. I can easily change access port in device details of the switch to managed state and it detects the thresholds fine. Problem comes when user turn
-
Can't acces my BIS account anymore
Hello, I bought a bb in USA like 2 months ago, I started using it inmediately with my provider and I started using the data plan about 20 days ago, I was able to register my account and everything, 2 days ago my data stop working, and I could not use
-
"Firefox has stopped working" message everytime the browser is closed
Everytime I close the browser, I get "Firefox has stopped working" message. I have Firefox 18 on a Windows 7 64-bit machine. I also uninstalled and re-installed firefox but the issue still remains
-
Hi I have a simple problem in regex. Whenever i try to write this piece of code i get an illegalStateException Matcher m = p.matcher(" absdsdfksj "); while (m.find()) { System.out.println("At loc : " + m.start()); System.out.println("Found
-
Add a new LOV item to a seed Iprocurement Page
Dear Forum, I am relatively new with OA Framework and have a query. In IProcurement-> Preferences Page -> Iproc Preferences, has many profiles that can be set to have a default value. I need to do the following add a NEW LOV item in the Delivery Bill