Starting program�s from Java.
Hi!
Do anyone know how to start, for examples Outlook or IE from my Java application?
//Thanks!
Runtime.getRuntime().exec("<my program>")
Similar Messages
-
Start JavaFX application from Java
Hello,
I have the following scenario:
I have a small JavaFX application and a big Java application. Now the Java App should call the JavaFX App to start up.
Further the JavaFX App has to call some methods from the Java App. Is this possible?
What is the best approach for my scenario?
Maybe somebody has made some experiences ..
thanks!
Edited by: 799878 on 03.11.2010 07:54"Now the Java App should call the JavaFX App to start up."
I'm assuming that the JavaFX code and the Java code are in the same application, correct? If so, then there are hacks available, but no standard way to start up JavaFX from Java will exist until the APIs have been ported from JavaFX script to Java.
"Further the JavaFX App has to call some methods from the Java App. Is this possible?"
Yes. Java can be called from JavaFX just fine. Just be careful if you use multi-threading or time consuming operations, since JavaFX script is apparently single threaded. Also be aware that netbeans normally compiles JavaFX applications with JSE version 1.5, so library features that did not exist until later versions will not be available by default. -
Starting weblogic server from java program
Runtime r=Runtime.getRuntime();
Process p=r.exec("cmd /c d:/bea/weblogic700/server/bin/setWLSEnv.cmd");
when ihave given like this it is working.
now i want to start weblogicserver from jav program
String s="-Dweblogic.Domain=mydomain weblogic.Server"
Process p=r.exec("cmd /c d:/bea/weblogic700/server/bin/setWLSEnv.cmd java "+s);
when i gave like this weblogicserver should start with specified domain
but no output is comming.please tellme where the problem isno - nothing happened. it perform the next java code - and there is nothing else happen on the windows.
maybe i don't check in the right place for the error you are talking about?
i also tried i simple cmd file that does nothing - but still nothing...
for any other file types it works properly. -
Starting IExporer.exe from java with J9 in an IPAQ
Hi all,
I'm trying to run IExplorer.exe from a java program in a IPAQ with j9 cvm.
I did try it in Windows 2000 and it works fine but when running it in the IPAQ with Windows CE it throws an exception.
Looks like the Exception is thrown because it can not find the file, but I think I'm writing the correct path and file name.
Here is the code and the exception. Can any one try it and tell me what Am I doing wrong.
Thanks a lot.
String s = "\\Windows\\iexplore.exe";
//String s = "\"C:\\Program Files\\Internet Explorer\\IEXPLORExx.EXE\"";
try
System.out.println("s: " + s);
Runtime runtime = Runtime.getRuntime();
Process p = runtime.exec(s);
catch(IOException ioEx)
ioEx.printStackTrace();
java.io.IOException: Unable to start program
Stack trace:
com/ibm/oti/lang/SystemProcess.create([Ljava/lang/String;[Ljava/lang/String;L
java/io/File;)Ljava/lang/Process;
java/lang/Runtime.exec([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)L
java/lang/Process;
java/lang/Runtime.exec(Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Lj
ava/lang/Process;
java/lang/Runtime.exec(Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Proce
ss;
java/lang/Runtime.exec(Ljava/lang/String;)Ljava/lang/Process;
com/gestorPosicion/inicio/InicioCliente.main([Ljava/lang/String;)VThe problem is that on PocketPC you cannot redirect input or output and the exec() call will not work as expected so it instead throws the exception to indicate this doesn't work on PocketPC.
-
How start programs out of java
I want to start a compiler from a j-application, has anyone an idea what I need to do so or where I can find a solution ?
Thanks in advancehi,
you could put the relevant commands in a script file (.sh in linux or .bat in windows) and then use the Runtime.exec to run the script.
for eg
java.lang.Runtime.getRuntime().exec("start command /K runcompiler.bat");
The above is specifically for win9x Os's.
hope this was useful.
cheerz
ynkrish -
Call c++ program .exe from java
Hello every body
i have a problem while calling Hello.exe from java
c++ code
#include "stdafx.h"
#include <iostream>
# include <string>
using namespace std;
int main(int argc, char *argv[])
int x;
cout<<"Just test ";
return 0;
}java code:
import java.io.IOException;
public class runtime{
public static void main(String[] args){
try
Process process = Runtime.getRuntime().exec("Hello.exe");
}catch (IOException e)
e.printStackTrace();
}it display nothing!!alexxzius wrote:
String line="";
BufferedReader input =
new BufferedReader
(new InputStreamReader(process.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
There is a danger of deadlock in this code. The OP should read the 4 sections of [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] and implement ALL the recommendations. -
Can programs run from java that is on web browser
i have written a program and used autorun to run when a cd is put on but not every body will have java on their computer a firend told me that most people will have java on the web browser that will be able to run the cd is this true or will i have to give download instructions to download jav first. this is obviously not ideal as i want people to be able to run the program by putting the cd in and nothing else.
1. You can create a Java applet, which is a Java program that runs
from a web page. It will need to be a signed applet. Your autorun will start the browser with the web page carrying the Java applet.
I don't think this is optimal.
2. Search for "embed JRE", which describes how you can supply your
private JRE with your program. It does not install the JRE, nor does it
care if one is already installed. I did this many times, there is no problem
at all, but here I have no idea whatsoever what happens if your JRE originates from write protected media. I guess it should work. Experiment or wait for others to see what they think. -
How can I copy an EXCEL file from a NT machine to a Unix machine and then present it on client's workstation, when the application server is in Unix. Please think of a situation wherein the EXCEL file got created on NT Server, the application server is installed on a Unix, web application is a Servlet running in Unix and the User initiates a request from a browser.
can someone please help. this is urgent for us.Can you please help by elaborating a little further?Yes - but SEARCH THE FORUMS, similar questions:
"how do I send an image the browser"
"how do I send a pdf the browser"
"how do I send a word/doc the browser"
set the mime type appropriately in the http response
write your byte stream to the http response output stream -
Starting a external program from java
hi iam trying to start MySQL server from java, the command in dos is as follows C:\mysql\bin\mysql -u username -p ,then the user hits return and the user is prompted to enter a password. i have got as far as entering the the C:\mysql\bin\mysql -u username -p but dont know how get the prompt back to the java program i would be greatfull if anyone could tell me where iam not doing,heres my code so far
try{
Runtime r=null;
r=r.getRuntime();
Process p=r.exec("C:/mysql/bin/mysql -u mark_r -p");
p.waitFor();}
catch(Exception ex){System.out.print("Error");}}You should try using the getOutputStream() and getInputStream() methods for the Process object. Each returns either an inputStream or OutputStream object.
You should be careful if the mySQL password is added to the command since anyone doing a 'ps' on the machine could see the password. -
I want to start logminer tool from java
To start logminer tool the first step is
alter system set utl_file_dir='C:\oracle\product\10.2.0\logminer_dir' scope=spfile;
shutdown immediate
startup
I am working on eclipse
The alter command is executed, but to startup and shutdown immediate, I am trying to use the below program. I getting the following error in eclipse
"Exception in thread "main" java.lang.Error: Unresolved compilation problems:
DatabaseStartupMode cannot be resolved or is not a field
DatabaseShutdownMode cannot be resolved or is not a field
DatabaseShutdownMode cannot be resolved or is not a field
at DBStartup1.main(DBStartup1.java:35)"
How to resolve it?????
import java.sql.*;
import java.util.Properties;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.pool.OracleDataSource;
* To logon as sysdba, you need to create a password file for user "sys":
* orapwd file=C:\oracle\product\10.2.0\db_1\dbs\orapw entries=5
* and add the following setting in init.ora:
* REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
* then restart the database.
public class DBStartup1
static final String DB_URL = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=XYZ.com)(PORT=1521))"
+ "(CONNECT_DATA=(SERVICE_NAME=rdbms.devplmt.XYZ.com)))";
public static void main(String[] argv) throws Exception
// Starting up the database:
OracleDataSource ds = new OracleDataSource();
Properties prop = new Properties();
prop.setProperty("user","system");
prop.setProperty("password","oracle");
prop.setProperty("internal_logon","sysdba");
prop.setProperty("prelim_auth","true");
ds.setConnectionProperties(prop);
ds.setURL(DB_URL);
OracleConnection conn = (OracleConnection)ds.getConnection();
//OracleConnection.getMode();
conn.startup (OracleConnection.DatabaseStartupMode.NO_RESTRICTION);
conn.close();
// Mounting and opening the database
OracleDataSource ds1 = new OracleDataSource();
Properties prop1 = new Properties();
prop1.setProperty("user","sys");
prop1.setProperty("password","manager");
prop1.setProperty("internal_logon","sysdba");
ds1.setConnectionProperties(prop1);
ds1.setURL(DB_URL);
OracleConnection conn1 = (OracleConnection)ds1.getConnection();
Statement stmt = conn1.createStatement();
stmt.executeUpdate("ALTER DATABASE MOUNT");
stmt.executeUpdate("ALTER DATABASE OPEN");
stmt.close();
conn1.close();
// Shutting down the database
OracleDataSource ds2 = new OracleDataSource();
Properties prop2 = new Properties();
prop.setProperty("user","sys");
prop.setProperty("password","manager");
prop.setProperty("internal_logon","sysdba");
ds2.setConnectionProperties(prop);
ds2.setURL(DB_URL);
OracleConnection conn2 = (OracleConnection)ds2.getConnection();
conn2.shutdown(OracleConnection.DatabaseShutdownMode.IMMEDIATE);
Statement stmt1 = conn2.createStatement();
stmt1.executeUpdate("ALTER DATABASE CLOSE NORMAL");
stmt1.executeUpdate("ALTER DATABASE DISMOUNT");
stmt1.close();
conn2.shutdown(OracleConnection.DatabaseShutdownMode.FINAL);
conn2.close();
}See other thread with the same name!
-
There is this command line program I want to wrap with a Java class in order to make it available so that it can be transparently called.
How can I call or execute external programs/commands from JAVA...
is not native code that I want to run...
Thank youRuntime.getRuntime().exec("your command line")... you could read more about it in the API documentation.
-
Starting an executable system command from java
I'm new to Java and i was wondering : is it possible to start an executable from Java under Windows? If so, how?
ThanxThere are only about 9 billion responses a day on how to do this. Use the search feature.
-
Hi,
How could I start an executable from within my Java application?
Something like:
public void start_converter(String toFormat){
String newFormat = toFormat;
if newFormat.equalsIgnoreCase("MIF"){
//call the MapInfo program
System.startup("MapBasic/convertToMIF.mbx"); // .startup is just a dumb guess. Are there any possibilities to do this in some way?
Thanks,
Anderstake a look at Runtime.getRuntime().exec(...) in the API
-
How to start a browser from within a java program?
I want to make a help file for my java program and want to run the browser from the menu of my program.
How can I start my browser from my program?
A small code will be helpful.
Thanks.
NiteenThis should work on Windows without having to know where the browser is located. See http://www.javaworld.com/javaworld/javatips/jw-javatip66.html for more details
public static void viewHtml(URL url, boolean fixHtmlExtension){
String cmd = "rundll32 url.dll,FileProtocolHandler " + url.toExternalForm();
if (fixHtmlExtension){
//There is a bug in rundll32. For http requests, it doesn't like .html or .htm extensions,
//but replacing the 'm' with '%6D' works.
//This fix is not needed for file requests.
if (cmd.endsWith(".htm")){
cmd = cmd.substring(0,cmd.length()-1) + "%6D";
else if (cmd.endsWith(".html")){
cmd = cmd.substring(0,cmd.length()-2) + "%6Dl";
Process process = Runtime.getRuntime().exec(cmd);
try{
process.waitFor();
catch(InterruptedException e){ -
I'm not even sure if this is an extension or plug-in and all I can tell you is what I have already stated. I can only make one command at a time and after each one I get a pop-up from Java script that says uninstal set. I must depress ok to move on, but only for one more command and it starts over again. This also happened when I tried to instal firefox 4 a couple months ago and I deleted the program and went back to an earlier version.
Mail troubleshooting - Yosemite
Troubleshooting sending and receiving email messages
Troubleshooting sending email messages
SMTP servers keep going offline
Maybe you are looking for
-
My IPad 6.1.3 is not allowing me to upgrade to 7.0.2 (not that I want to after the horror stories) but I would like your advice on what to do. It's not memory because I have 23.3gb available. Also, my delete button in photos does not appear to be wor
-
How to access FMS from outside on a web server
I have installed FMS developer version on a small web server that has several websites on it. How do I reference the FMS server from an application on the web server, or from the outside somewhere? My flash development is done on a workstation, and I
-
Render html form & send forms's input values as params via HTTP POST
Hello, I'm using appache commons http client to send HTTP post queries to a given url and receive HTTP response then process it. one of the requirements of my Application is the following: one of these HTTP Post requests is supposed to return an HTML
-
Significance of Quotation Deadline
Can anybody tell me the Significance of Quotation Dead line in RFQ?? As per SAP Help Date by which the vendor is to submit the quotation. If the Vendor Submitted late then where to maintain it?? How the System will restrict late submmission ??
-
Joining the cube members in OBI
Hi I have got the following members in cube : Years --- 2007 ---- 2008 ---- 2009 Year ---- Quarter ----- Month ----- Day and the other FACT members. Now When I am importing the cube into OBI there would be two separate tables and drill down would be