Start a java program from an FMB then read and write some variables
Hello,
I am trying to see whether the following setup works:
item A, B, D and Button Z are on a Forms Canvas.
User clicks on Button Z. This will launch a java program (Myprog class).
Myprog main will read values in item A and B, run some calculation and then will return it back to our forms module and then will be displayed in item D.
I have read about PL/SQL wrapper but the way I am looking at my setup is that my Forms module will be just the GUI interface.
Any ideas ?
main thing: a JAVA class that will take some inputs and will output some results and messages.
Prob: I do not want to use swing or any other GUI builder to make a nice GUI for my JAVA class.
What I want: I know how to use Forms. As such, I just want to put together a quick interface (mymodule.fmb) that when executed will allow the user to click on a button to start the java process and then see the results and error messages.
Why I don't want to go through SWING: my main prob is to get the java class executed ( which is fine right now thru command line) by other users thru a GUI interface. I do not have time to go thru SWING.
From the paper I mentioned, I think the PJC is the way to go. Can you please confirm ?
Thanks.
Similar Messages
-
Starting a java program from a button
Hi,
How can i start another java application (which is saparated from the orginal application) by pressing a button in the main application?
what should the action be?
tia,TheOtherClass.main(theArgs);Though you might want to create a new thread for that call first.
-
Is there a way to start a JAVA program from the dock?
Hello,
I wrote some JAVA applications and I would like to put them in -
- and start them from - the dock.
These applications were built into .jar files.
I can start them from Finder which tells me that there is some .jar starter utility.
;JOOP!The Dock is for Applications, Documents, and Folders (which can take several forms). There are some other odd animals that can stay in the Dock, but they were never truly implemented (recent items is one). If you "wrap" the .jar file inside some package that behaves as an application, you can have it stay in the Dock just as any other Application.
A .jar file is not an application, it's a java archive. It is a collection of classes, metadata, etc. which the Java runtime interprets and executes. The Application which runs it shows up in the Dock as the coffee cup, but that is just the runtime engine, not the .jar.
The .jar is like any other document, such as a a word processing document. Just like any document, it can be double-clicked and the handling application will be called to open it. Double-clicking that word processing document causes the word processing application to open the document and interpret its contents. Double-clicking the .jar file causes the java runtime engine to open the .jar file and interpret its contents. Instead of presenting it as paragraphs of text, it displays it as the application it represents. -
Calling one java program from another
Hello,
How can I start another java program from one? Lets
say I want Second.java to start by calling it from
First.java. How do I do it? The two programs are given
below. Any help is appreciated.
Thanks,
Amanda
First.java
import java.io.*;
import java.lang.reflect.*;
public class First
public static void main(String[] args)
Process theProcess=null;
System.out.println("Hello World from First.java!");
String second=new String("Second.java");
//System.load(second);
//Runtime.getRuntime().load(second);
try
theProcess=Runtime.getRuntime().exec( "Second.java"
System.out.println("after exec");
catch (IOException ioe)
System.out.println(">>IOException thrown in
First.java while calling
Second.java."+ioe.getMessage());
Second.java
public class Second
public static void main(String[] args)
System.out.println("Hello World from Second.java!");
}Thanks, warnerja
What if Second.java is on a remote machine i.e.
First.java and second.java are on different machines?
Will I have to use RMI?Well, you'd have to do some kind of remote invocation. Depends on what kinds of apps house the classes. There are all kinds of ways - web services, servlets, RMI, (maybe others...)
That's a totally different question than what you originally posted, and would have been very relevant to say so in the first place. -
How to start an executable program from a java program ?
Hi,
does someone know how to start an executable program from a JAVA program ?
Thanks, Fred.Take a look at the Runtime class.
-S- -
Error while calling java program from ABAP
Hi Experts,
We are trying for RFC inbound scenario.
We followed the below blog
/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
We are working with SAP JCO 3.0.2
We are getting the error : 'STFC_CONNECTION' could not be found in the server repository.
After I run the Java server program if I execute the RFC destination directly from SM 59 it is showing successful messages.
If I stop the java program then this RFC is failing. Based on this we concluded that RFC to Java connection is working fine.
But as mentioned in blog if we call the RFC Destination from ABAP program it is giving the below error,
'STFC_CONNECTION' could not be found in the server repository.
If we test the RFC destination using RFC_TRUSTED_CHECK standard FM we are getting the below error.
'RFCPING' could not be found in the server repository.
We create the RFC destination of Type : TCP/IP as exactly mention in the blog.
Please help us in resolving this issue.
Thanks
PrincePabi,
Using the RFC connection,we can establish a link between Java and SAP.
Afterwards,hope we can call Java program from ABAP.
Below is the sample piece of code to establish RFC connection(link) between Java and SAP.
DATA: REQUTEXT LIKE SY-LISEL,
RESPTEXT LIKE SY-LISEL,
ECHOTEXT LIKE SY-LISEL.
DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
DATA: RFC_MESS(128).
REQUTEXT = 'HELLO WORLD'.
RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION RFCDEST
EXPORTING
REQUTEXT = REQUTEXT
IMPORTING
RESPTEXT = RESPTEXT
ECHOTEXT = ECHOTEXT
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE RFC_MESS
COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
IF SY-SUBRC NE 0.
WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC.
WRITE: / RFC_MESS.
ENDIF.
Regards,
Sree -
Not able to execute one Java program from another one via. exec()
Hi,
I am new to this forum, so I might be asking a very trivial quetion.
My program Ap1 is :
class Ap1
public static void main(String a[]) throws Exception
Runtime rt=Runtime.getRuntime();
Process p=null;
p=rt.exec("javac,Pr.java");
Runtime.getRuntime().exec("javac,Pr.java");
When I run the above program, I get below error at the line 7(bold one):
D:\batchwe>javac Ap1.java
D:\batchwe>java Ap1
Exception in thread "main" java.io.IOException: CreateProcess: javac,Pr.java err
or=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:429)
at java.lang.Runtime.exec(Runtime.java:326)
at Ap1.main(Ap1.java:7)
Path is set as below(which seems correct):
D:\batchwe>path
PATH=C:\Program Files\Java\jdk1.5.0_05\bin
I am just wondering how to call one Java program from another one?!
Please help.
thanks
RashmiHi diptaPB,
Thanks for your suggestion.
Here is how I tried it again, but not getting the desired output:
Class Pr looks like below -->
class Pr
public static void main(String a[])
System.out.println("hi from process");
When I run 'Pr' from command prompt, i get the desired output:
D:\batchwe>java Pr
hi from process
However, when I call 'Pr' from another program Ap2.java, it seems that it does not call 'Pr':
class Ap2
public static void main(String a[]) throws Exception
Runtime rt=Runtime.getRuntime();
Process p=null;
String[] cmd=new String[2];
cmd[0]="javac";
cmd[1]="Pr.java";
p=rt.exec("cmd");
D:\batchwe>javac Ap2.java
D:\batchwe>java Ap2
************* no output appears here***********************
Looking forward for your help.
regards
Rashmi -
Starting a java program on System boot/startup
Hi,
I am trying to find out how to start a java program on system startup which basically spawns a Thread which in turn does some processing.
Came across windows specific options which help one make it as a service.Making a .bat for windows and .sh for linux could be a option but not sure where to put these in respective OS or whether it is a good option.
If someone has tried out similar thing please let me know the details for the same.
Regards
Raj[codes]
in command prompt
type edit startupor somename.bat
then type
cd C:\Program Files\Java\jdk1.5.0_01\bin
javac data1.java
java data1
and save
[codes]
copy startup.bat file
and click on start-->programs--> startup(rigthclick and open)
then paste that file into that folder...
now you ll get that file opened whenever system boots.
reply if this was usefull;) -
Execute a java program from an another program
Like we can compile a code from wihin a java file by using the following :
Tool javac = ToolProvider.getSystemJavaCompiler();
Similarly,can we execute i.e. run a java program from within a java file i.e. running d java command from within the java file ??If yes then please tell me how??suppose on the Unix box or from a Unix script ( korn, perl, bourne, bash) you can run the following java program
java ${JAVA_OPTS} -jar ${GMR_APPS_DIR}/risk.jar -I -c ${COB} -r ${BATCH} -o ${XML_DIR}
in java you can do the following :
Runtime rt = Runtime.getRuntime();
try {
Process process = rt.exec("java ${JAVA_OPTS} -jar ${GMR_APPS_DIR}/risk.jar -I -c ${COB} -r ${BATCH} -o ${XML_DIR}
// OR
Process process = rt.exec("/export/apps/Tools/apache-tomcat-5.5.17/bin/startup.sh");
// process.destroy(); if you want to kill the process
process.waitFor();
int RC = process.exitValue();
System.out.println(returnOutput(process.getErrorStream()));
System.out.println(returnOutput(process.getInputStream()));
} catch (Exception ex) {
ex.printStackTrace();
empty the output stream from the script
private String returnOutput(InputStream is) throws Exception {
String s;
StringBuffer strBuff = new StringBuffer();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
while ((s = br.readLine()) != null) {
strBuff.append(s);
return strBuff.toString();
}You need to relace the ${} by the appropriate values.
Regards,
Alan Mehio
London, UK
Edited by: alan_mehio on Jan 16, 2008 4:21 PM -
Calling Java program from ABAP
Hi All,
my ABAP program downloads one file to one folder. Then one Java program is running to Encrypt the file.
Now , they want to call the JAVA program in ABAP, so that they can encrypt the file before downloading.
Is it possible to call a Java program from ABAP ? If Yes, please give me the detailed procedure.
Thanks
pabiPabi,
Using the RFC connection,we can establish a link between Java and SAP.
Afterwards,hope we can call Java program from ABAP.
Below is the sample piece of code to establish RFC connection(link) between Java and SAP.
DATA: REQUTEXT LIKE SY-LISEL,
RESPTEXT LIKE SY-LISEL,
ECHOTEXT LIKE SY-LISEL.
DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
DATA: RFC_MESS(128).
REQUTEXT = 'HELLO WORLD'.
RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
CALL FUNCTION 'STFC_CONNECTION'
DESTINATION RFCDEST
EXPORTING
REQUTEXT = REQUTEXT
IMPORTING
RESPTEXT = RESPTEXT
ECHOTEXT = ECHOTEXT
EXCEPTIONS
SYSTEM_FAILURE = 1 MESSAGE RFC_MESS
COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
IF SY-SUBRC NE 0.
WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC.
WRITE: / RFC_MESS.
ENDIF.
Regards,
Sree -
How to run java program from website?
Hello
I'd like to know how to run java program from my web page.
I'd like to push some button in this web page so java program that would be on my server
would pop-up. Can it be done automaticaly upon running this web site? (without any buttons - I just enter website and program pops up).
CheersI rather thought about RMI. But I could try servlets. So how it would look like?.
I would make http request in browser (enter address) and program would show up in its window?. And I would not have to change anything in my program?. This program would run then on both boxes?. One remotely and one not?.
But I would have to learn some basics, I've never worked with servlets. Could you suggest some good sites about it?. With ready examples so I could tweak them to my purpose.
Message was edited by:
macmacmac -
How to call java program from javascript
Hi,
I have an java program which will transform one xml to another xml using XSLT.
I want to call this java program from Javascript? Is this possible? Please suggest me.
Thanks,
Gopalis it not possible?
do i have to refresh the page and read in the values like...
<%
String ename = request.getParameter( "EmployeeName");
session.setAttribute( "ename", ename);
%>and then call the class from here?
looking around ive come across ajax but i dont know how to use it and what you need to install and if its compatable with tomcat and jsp?
is ajax better or not really worth it?
i have anything up to 100 fields that need saving at one save click -
How to run java programs from a master java program?
Hello,
I have several java programs which run from the command prompt. I am seeking help with code for starting java programs from within a java program. For example, a program called master.java works something like this:
import java.*;
create connection pool
create variables and result sets
start/run slave1.java (var1, var2);
start/run slave2.java (var3, var4, var5);
start/run slave3.java (var1, var4);
end of program master.java
Each of the slave.java programs will run for up to an hour. I do not want the master.java program to pause for each slave program to stop. Instead, the master program will keep running and multiple slave programs will be running simultaneously with the master program. When a slave program starts, it is on its own. Also, if possible, I would like to have each of these slave.java programs open in a new separate command window, so I can observe each slave program running in separate windows.
Any suggestions for code or helpful documentation are greatly appreciated.
Thank you,
LoganThank you all.
At the bottom of master.java I have successfully started a batch file with these lines:
String jcmd = "cmd.exe /c start c:/data/simulations/MsgViewCount2.bat";
Process proc = Runtime.getRuntime().exec(jcmd);
But I still cannot get a java program to start. Here is one variation I have tried:
String [] cmdArray = new String[2];
cmdArray[0] = "java";
cmdArray[1] = "slave1";
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(cmdArray);
This compiles, and no errors occur, but nothing happens.
Regarding this comment:
Why Runtime.exec? Either make the slaves Runnable or
just call their main() methods.
Oh, I see. Sepearate output. :PNone of the slave.java programs have any output.
Thanks again. -
How to invoke a Java Program from Oracle 10g?(uRGENT)
Hello.
I've a query, that i have a program, that basically retreives the records from the
oracle table and then parser this information and then insert the values in corresponding database base tables. I want that, whenever the new program is inserted, a Trigger should fire and pass the most recently entered record to the Parser Program, means
1) Firing a Trigge
2)Storing the most latest data and pass it to the Parser PROGRAM
Can someone tell me how to do this? How to invoke a Java Program from within the database? Please if anyone has examples provide me. Its very urgent and tell me what is the basic mechanism.
Thankyou.
BenWith Java Stored Procedures Java may be caleed from a database.
http://www.oracle.com/technology/tech/java/jsp/index.html -
How to execute a Java program from ODI
Hi All,
I am new to ODI. I would like to know whether its possible to execute a java program from ODI.
Reason for this is, I would like to write information in error tables into a file. And after that another program will mail that error log to concerned person.
Could anyone please help me with this?
Thank you in advance
Regards,
Sriniif you have the java code then u can create a procedure with Java BeanShell as the Technology and write your java code in the procedure
Maybe you are looking for
-
Also due to the implementation
Even though e-commerce has brought a large amount of benefits to the user, it also poses a series of disadvantages. Hackers can gain access to sensitive information when these online transactions are made. In addition to the losses sustained by the u
-
Setting the page encoding with an extension
Folks: DW CS3 on MacOS 10.6.x I have a lot of legacy files encoded in ISO Latin-1 --and some exception cases in other encodings-- and I'd like to convert uniformly to UTF8. It's sufficient to convert files one-by-one as I work on them for other r
-
IBooks not picking up metadata
Having had a hdd crisis and replaced it, I upgraded to Mavericks. When I imported my books from a back up folder I got the title, the cover image but no author. I have checked the metadata in Calibre and it's all there. Is there any way for me to
-
HT1430 My Ipad has frozen. I cannot restart it. Display comes up. Nothing works
The iCloud "Not enough storage" message is displayed but no buttons worki. The ipad has not be dropped or otherwise physically damaged. Has any one encounted the problem and solved it? If so would you mind telling me how you did it? Thanks.
-
Essbase unix file system best practice
Is there such thing in essbase as storing files in different file system to avoid i/o contention? Like for example in Oracle, it is best practice to store index files and data files indifferent location to avoid i/o contention. If everything in essba