How to call javascript from java application
How can we call a function written in javascript from java application (core java not applet)? How will java identify javascript?
Is there any such options ?
Try creating a page called launcher.html (for example). That does this:
<html>
<head>
<script language="javascript">
windowHandle=window.open("http://www.javasoft.com", "", "height=700,width=1000,status=no,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=5,left=5");
</script>
</head>
</html>Now you launch IE (or whatever) with this page using the Runtime class. After x seconds (after the second window has been launched) try killing the process. Hopefully it will kill the original window you opened and not the window you popup (the one without toolbars etc)
It might kill both windows but I can't be bothered to test it. If it does you'll have to try and find a workaround.
Similar Messages
-
How to call webservice from Java application
Hi XI gurus
Pls let me know how to call a webservice from Java application.
I wanted to build synchronous interface from Java Application to SAP using SAP XI
For example, i need to create Material master from Java application and the return message from SAP, should be seen in Java application
Regards
MDHi,
If your JAVA Application is Web based application, you can expose it as Webservice.
JAVA People will pick the data from Dbase using their application and will send the data to XI by using our XI Details like Message Interface and Data type structure and all.
So we can Use SOAP Adapter or HTTP in XI..
If you use HTTP for sending the data to XI means there is no need of Adapter also. why because HTTP sits on ABAP Stack and can directly communicate with the XI Integration Server Directly
If you are dealing with the Webservice and SAP Applications means check this
Walkthrough - SOAP XI RFC/BAPI
REgards
Seshagiri -
How to call a WD JAVA application from a WD ABAP application
Hi experts,
Here I have two applications with me. One has been created through WebDynpro ABAP while the other one has been created through WebDynpro JAVA. Now i have to call upon the JAVA aplication from my ABAp application. In other words in need to integrate both the applications so as to have an easy navigation in between them.
In the whole process I need to take care that the data is not lost from both ABAP or JAVA side.
Please help me someone knows the solution.
Regards,
Kaustubh MaithaniHi,
Usally to run WebDynpro for Java Application, we get the Application URL.
If you want to call this WebDynpro Java Application from Webdynpro Abap, then create UI element like Link to Action or LinktoURL and give the url as WebDynpro for Java URL.
Regards,
Lakshmi Prasad. -
"ReferenceError: "myIpAddr" is not defined, when call JavaScript from java
Hi developers,
My java application was trying to issue a http request via proxy auto-config. So, I did below jobs
1. Read URL of *.pac from registry
2. Call FindProxyForURL from java, the code is like below
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval(autoProxyScript);
Invocable inv = (Invocable) engine;
Object obj = inv.invokeFunction("FindProxyForURL",
"http://java.sun.com/",
"java.sun.com");
However, I got "ReferenceError: "myIpAddress" is not defined
I can not change the script on server to add a function like "myIpAddress", I am wordering why IE or mozilla can call it successfully and get proxy server, while Java failed to do that.
I got a ugly solution by calling "pacparser" by jni. But I really hope I can get a better solution.A .pac file is a JavaScript, but it requires some functions to be defined in the executing context to work (i.e. you must define those).
From the example on the Wikipedia page there's at least "shExpMatch" and "isInNet". "myIpAddress" seems to be another such candidate. -
Hi
I want to use xml for updating files in an existing jar . so i want to call xml from java code and then come back to java code and do the remaining work in java code, pl guide me how to do this . what APIs are helpful for this regard
ThanksYou can't update files in a jar. Even if you could, you wouldn't use XML for that. You don't call XML. XML is not a programming language. So, basically your entire question is misguided.
-
How to call a AWT java application from TELNET ?
Dear All,
I've created a java Application using AWT, can anyone advise how it could be called using TELNET.
Thanks in advance,
Best regards,
LanaAdditionally, multi-posted to the Java Mobile sub-forum of this OTN site, as well.
How to create a java application & call it from a PDA via TELNET
Your impatience is your issue, not anyone else's. -
JDeveloper Team - How to print Barcodes from java application
We are developing an Inventory based application in JDeveloper 3.2.2/Oracle 8i/Netscape Enterprice web server on Windows NT platform. The application is developed in swing technology.
We have to print Barcodes on Intermec 3400/4100 or Zeebra Z4000 (connected to COM1/COM2) from our java application from one of our screens.
Can you please point me to right place or get me sample source how to achieve this. We are working on a timebound deadline and we are really counting on your sincere response ASAP. Thanks in advance.
VR
nullTry creating a page called launcher.html (for example). That does this:
<html>
<head>
<script language="javascript">
windowHandle=window.open("http://www.javasoft.com", "", "height=700,width=1000,status=no,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=5,left=5");
</script>
</head>
</html>Now you launch IE (or whatever) with this page using the Runtime class. After x seconds (after the second window has been launched) try killing the process. Hopefully it will kill the original window you opened and not the window you popup (the one without toolbars etc)
It might kill both windows but I can't be bothered to test it. If it does you'll have to try and find a workaround. -
How to access .asmx from java application
Hi All,
I want to access .asmx file using java application. I am using Eclipse IDE and created
some samples from this url: http://www.eclipse.org/webtools/jst/components/ws/M5/tutorials/BottomUpWebService.html
I got the Soap request and response format from wsdl file. But, i don't know access
the .asmx file. If u have any samples or give some suggestions that will be helpful for me to
proceedTry creating a page called launcher.html (for example). That does this:
<html>
<head>
<script language="javascript">
windowHandle=window.open("http://www.javasoft.com", "", "height=700,width=1000,status=no,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=5,left=5");
</script>
</head>
</html>Now you launch IE (or whatever) with this page using the Runtime class. After x seconds (after the second window has been launched) try killing the process. Hopefully it will kill the original window you opened and not the window you popup (the one without toolbars etc)
It might kill both windows but I can't be bothered to test it. If it does you'll have to try and find a workaround. -
Hi everybody,
I am trying to call a dll from my java application. Pls tell me how to do it, I seached and found JNI. Is it true
pls help me and send me some examples
Thank you and have a nice dayjava_and_me wrote:
I am trying to call a dll from my java application. Pls tell me how to do it, I seached and found JNI. Is it trueYes, it is true. JNI is the way to go. You'll probably have to write some C code on your own as well, as the DLL is unlikely to be in the format expected by Java already.
pls help me and send me some examplesOf course. [Here you are|http://www.lmgtfy.com/?q=JNI+tutorial]. -
I am not able get the javascript funtion executed.
Pl. help me.
A Javascript function is called from Java by using the showDocument method. A URL is needed with "javascript:" as the protocol.
[Java applet] import java.applet.*;
import java.net.*;
public class inJava extends Applet{
public void init(){
String msg = "We will jump to an HTML tag";
try {
getAppletContext().showDocument
(new URL("javascript:doAlert(\"" + msg +"\")"));
getAppletContext().showDocument
(new URL("javascript:jumpTo(\"#JUMP\")"));
catch (MalformedURLException me) { }
[Javascript and HTML] <HTML><HEAD></HEAD><BODY>
<SCRIPT>
function doAlert(s) {
alert(s);
function jumpTo(tag) {
self.location=tag;
</SCRIPT>
<APPLET CODE="inJava.class"
NAME="myApplet" MAYSCRIPT
HEIGHT=400 WIDTH=10>
</APPLET>
<P>
<A NAME="JUMP">jump here from Java via Javascript</A>
</BODY>
</HTML>
Thanks
vemaVema,
you cannot go this way. Let me copy/paste the piece of my code:
JSObject.getWindow( applet ).call( "open", new String[] { /* list of parameters of 'open()' function */ });
vpanasenko_even -
How to call transaction from webdynpro application
Hi Experts,
I have a web dynpro component zxx_comp.its corresponding web dynpro application zxx_app.
my requirement is , when i test the webdynpro application, i have to call a transaction zxx_txn corresponds to the module pool program zxx_pgm directly . How can i do that?
Regards
Ashwin KVHi Ashwin,
Use the following to open a T-Code from WD application.
CALL METHOD cl_http_server=>if_http_server~get_location
IMPORTING
host = lv_host
port = lv_port
out_protocol = lv_protocol.
DATA lv_url type string.
concatenate lv_protocol '://' lv_host ':' lv_port '/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction='zxx_txn' into lv_url.
DATA lo_window_manager TYPE REF TO if_wd_window_manager.
DATA lo_api_component TYPE REF TO if_wd_component.
DATA lo_window TYPE REF TO if_wd_window.
lo_api_component = wd_comp_controller->wd_get_api( ).
lo_window_manager = lo_api_component->get_window_manager( ).
lo_window_manager->create_external_window(
EXPORTING
url = lv_url
RECEIVING
window = lo_window ).
Regards,
Harsha -
How to call xsl from java?
Hi All,
My main java class 'OrderCustomerEntry' is located in package 'Order.Profiles.Customer'
I have my xml input stored in a String object. Now I have stored a xsl in the same package 'Order.Profiles.Customer'.
I make certain updations to my xml. After that, I have to call a xsl, which will finally do some transformations on my xml.
Kindly tell me how to call this xsl file from java.
Thanks,
Sabarisri. N
Edited by: Sabarisri N on Oct 11, 2011 11:15 AMThis can be complicated with many factors coming into play. Suppose everything is set up in good order, if the xsl is stored in the jar containing the package Order.Profiles.Customer at its root. That means, the jar has some structure like this:
Order/Profiles/CustomerOrderCustomerEntry.class
META-INF/...
xyz.xsl
etcYou may try this when load it up.
String xslFile="xyz.xsl";
//tf being the factory
Transformer transformer = tf.newTransformer(new StreamSource(ClassLoader.getSystemResourceAsStream(xslFile)));The change with respect to the case where the xslFile is in the current directory is the ClassLoader part.
Suppose it is stored in a resource directory say "res".
Order/Profiles/CustomerOrderCustomerEntry.class
META-INF/...
res/xyz.xsl
etcThe corresponding lines would look like this.
String xslFile="res/xyz.xsl";
//tf being the factory
Transformer transformer = tf.newTransformer(new StreamSource(ClassLoader.getSystemResourceAsStream(xslFile)));Hopefully, this may be enough to get you going...
ps: Although no one should force anyone on the way to name packages, the majority in the industry uses all lowercase characters whenever possible. -
How to call infotypes from webdynpro applications
Hi friends
My requirement is, I need to call infotypes in r/3 system. Exact requirement is I got a dropdown, which gets the data from infotype, I got a textview which also gets the the data from other infotype.My question how to call these infotypes. Is this is the same way like importing bapis or different. Please let me know the detail procedure, and any doccuemnts mail me to [email protected]
Regards
keerthiHello Keerthi,
it is no special way to call infotypes, you have to find a Bapi which return data you want (or part of this thata). When there is no Bapi which fill your requirements (or you must call to much bapis) i think you should write your own bapi. Last step is using this (own or found) in wdp.
Regards
Bogdan -
How to call infotypes from webdynpro application
Hi friends
My requirement is, I need to call infotypes in r/3 system. Exact requirement is I got a dropdown, which gets the data from infotype, I got a textview which also gets the the data from other infotype.My question how to call these infotypes. Is this is the same way like importing bapis or different. Please let me know the detail procedure, and any doccuemnts mail me to [email protected]
Regards
keerthiFor reading HR infotypes you have to do the following
a. Create a Remote enabled function module (FM) in the HR syste. This FM shall wrap the standard FM HR_READ_INFOTYPE.
b. Create a Model in your webdynpro project for the FM you developed in step a.
Thanks and Regards,
Prasanna Krishnamurthy -
The following code will open 'Notepad'
Runtime runt = Runtime.getRuntime();
Process pr = runt.exec( "notepad" );likewise, I want to open 'Wordpad'
Runtime runt = Runtime.getRuntime();
Process pr = runt.exec( "wordpad" );The above two line code, compiles successfully, but it doesn't give the correct result.
If I give 'wordpad' in start->run->'wordpad', in windowXP means, the Runtime executer opens 'WordPad',
can anyone give the solution to open WordPad from Java Programming.
thanks
Sarwan_GresTry this:
Runtime runt = Runtime.getRuntime();
Process pr = runt.exec("cmd /c start wordpad");
Maybe you are looking for
-
When im trying to download itunes it keeps saying R6034 application has made an attempt to load the C runtime library incorrectly error 7 windows error 1114
-
To access a package, the calling class must reside in the root/parent direc
My goal was to be able to access my package from anywhere within the high level root folder (d:\zJava). But it seems the invoking class MUST RESIDE IN THE TOP LEVEL PARENT DIRECTORY of the package. Was Java designed to behave this way? D:\zJava\zsamp
-
I bought a new pc, but my nokia ovi suite settings and info are on the other pc. how doe i transfer those to my new pc? (nokia e7) the music playlist is top priority (A) thank you for your time
-
Isolate app server from external RFC's, idocs
There is a server in our SAP R3 landscape that needs to be isolated both from user logon, external communiction like idocs and also load balancing of batch jobs to this server. The user logon is no issue, config via SMLG by not including the server
-
Retail:Not getting the new G/L account in WPER
Hi Experts, I am going to SPRO --> sales and distribution --> POS interface -->Transaction Type-Dependent Control Of Financial Transactions and changing the G/L account from 160000 to 1610000 for chart of accts 1000 for the ZPOS inbound profile which