How To Run An External .exe File With Command Line Arguments
Hiya, could anyone tell me how I can run an external .exe file with command line arguments in Java, and if possible catch any printouts the external .exe file prints to the command line.
Thanks.
Using the Runtime.exec() command. And read this:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Similar Messages
-
How to run an external .exe file from an indesign pluging
Hi,
Suppose if I have written an separate application in C++ (.exe file) & need to run it from an indesign pluging(as if a service in windows). have you provided that facilities in your SDK? if it's please let me know how to run an external .exe file from a indesign pluging.
Thanks,I'm actully writing data in PMString to a external txt file.
another question..
if i want to execute an action when the ok button is cliked how can i do it?
whe i add a button(widget) i know how to handle it. please see my code.
// Call the base class Update function so that default behavior will still occur (OK and Cancel buttons, etc.).
CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
do
InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
ASSERT(controlView);
if(!controlView) {
break;
// Get the button ID from the view.
WidgetID theSelectedWidget = controlView->GetWidgetID();
if (theChange == kTrueStateMessage)
//if (theSelectedWidget == kEXTCODGoButtonWidgetID
switch(theSelectedWidget.Get())
case kEXTCODGoButtonWidgetID:
this->ViewOutput();
break;
case kEXTCODFindButtonWidgetID:
this->SaveLog();
break;
// TODO: process this
} while (kFalse);
I do two actions "SaveLog" & "ViewOutput()" using two buttons. But i dont know how to execute an action when the ok button is clicked... -
Import biar file with command line
Hi
I am trying to import biar file with command line on unix environment with BOXI R3.1 and Oracle DB
The biar file include one universe and it's connection (eFashion), one report and one user
when I run the command line:
java -jar /BO/boxi/bobje/java/lib/biarengine.jar /BO/boxi/test.properties
I recive the following error:
Failed to commit objects to server : Undefined Info Store error
An error occurred at the server during security batch commit:
Request 6 of type 36 failed with server error : Object not found (1433)
Request 11 of type 36 failed with server error : Object not found (1433)
Request 20 of type 38 failed with server error : Object not found (1433)
Request 26 of type 38 failed with server error : Object not found (1433)
Do you have any idea , what is the problem?
Thank youHi Denis
I found out after I create a biar file ,with only the user, through a command line. that the user did import since it was in a concurrent connectiontype , a type that not exit in the target environment.
But after I fix this in the source environment and saw that a biar file with only the user is loaded , I recreate the biar file with all the objects as before (user, universe, report , folder) and I still got the same error message as before.
So now I try to create the biar file with all those object through the command line. and I get a new errer message "Required dependencies not found on target system : '[AZK_.9sbf_lMgdQRpsbZfVw]"
I check it , and understand that the object is the report , but I do not see what missing..... : (
Those are the quries in the properties file:
exportQuery= SELECT * FROM CI_APPOBJECTS where si_kind = 'Universe' and si_name='eFashion'
exportQuery= SELECT * FROM CI_APPOBJECTS WHERE SI_ID in ( 894,926)
exportQuery= SELECT * from CI_SYSTEMOBJECTS WHERE SI_KIND = 'user' and SI_Name='repadmin'
exportQuery= SELECT * FROM CI_INFOOBJECTS WHERE si_kind= 'Folder' and SI_name = 'test'
exportQuery= SELECT * FROM CI_INFOOBJECTS WHERE SI_ID IN (2188)
Can you tell what is missing? -
How to run form in the background from command line
please can anybody tell me to
how to run form in the background from command line
vishalUmmm....Oracle Forms is a foreground runtime kind of thing. What you want is a database procedure (or an OS utility - it depends on what sort of processing you want to do in the background).
Cheers, APC -
In making .ard file what command line argument
In making .ard file what command line argument must be kept
Taken form SAP Business One Development Environment Project.
.bat file:
"SAPAddOnRegDataGenFileFolder\AddOnRegDataGen.exe" "YourAddOnInstallXMLFolder\YourAddOnInstall.xml" "1.1" "YourAddOnInstallFolder\YourAddOnInstall.exe" "YourAddOnInstallFolder\YourAddOnInstall.exe" "YourAddOnFolder\YourAddOn.exe"
.xml file:
<AddOnInfo partnernmsp="YOU" contdata="Your Name" addonname="YOUR ADD-ON" addongroup="M" esttime="60" instparams="" uncmdarg="/x" partnername="YOU" unesttime="30" />
Hope it helps.
D. -
How can I create a exe file with a tab control on it that work´s ?
I have a VI with many controls and indicators,these are spread on a tab control.This tab control works with out any problems but if i create a exe file then the tab control is fixed. How can I create a exe file so that the tab control on it work´s ?
I have made a new Posting with the same question but this time I added a screenshot of the VI.
Attachments:
project7.1.jpg 129 KB -
Launch executable with command line arguments
I have a programmer that I need to launch in my cvi code. I tried the system command and lauchexecutable command but cannot get the programmer to lauch correctly. If I run it from the command prompt or create a windows shortcut it works fine. Here is the shortcut I created:
C:\TPD\SAVS20P3\asix\up\up.exe /e c:\tpd\savs20p3\q33.hex/erase /q /p
I'm trying to run the up.exe software with /e c:\tpd\v20_hex\v20.hex /erase /q /p as the command line paramters.
I tried the following code which created the above path with command line
strcpy(filename,"C:\\tpd\\savs20p3\\asix\\up\\up.exe /e c:\\tpd\\savs20p3\\hex_ee\\"); ///e c:\\tpd\\savs20p3\\hex_ee\\"");
strcat(filename, hfile);//hex file name will change dynamically
strcat(filename, "/q /p");
I then tried LaunchExecutable(filename) and system(filename). The system functions gives an error. Its trying to lauch the /e c:\tpd\v20_hex\v20.hex file
any suggestions. I beieve its a simple syntax error.Well, apart evident typos in the code you posted, which is not creating the command line you stated, I can only think that before "/q" you should add a space to separate the option from the filename.
This code should create the correct command line:
strcpy (hfile, "c:\\tpd\\v20_hex\\v20.hex");
strcpy (filename, "C:\\tpd\\savs20p3\\asix\\up\\up.exe /e ");
strcat (filename, hfile);
strcat (filename, " /erase /q /p");
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Problem associated with Command Line arguments
hi ,
I am not able to pass a file path as command line argument in java.
Actually i want to run a java program from the command prompt passing a file path . Something like this i tried to do , but its not working.
D:\VISHAL\src> java CopyFile C:\Documents and Settings\Administrator\Desktop\link.txt
where ,
CopyFile is the name of my class which i am going to run
C:\Documents and Settings\Administrator\Desktop\link.txt is the argument.
Can anyone tell me whether a java program accepts an argument like this, if yes please tell me the exact syntax..
Thanks
Vishal J
Message was edited by:
vishal_vjis there any other way of solving this?Y don't U try it out with the logic as mentioned
below it wud be the case if U r not going with
java CopyFile "C:\Documents and
Settings\Administrator\Desktop\link.txt" 1
String filepath = new String();
for(int i = 0; i < Arg.length; i++)
filepath.append(Arg);
File f = new File(filepath);
What???? This is a non-solution to a non-problem. First of all, you would be constructing a filename without spaces, when the real path contains spaces. Secondly, even if you did insert spaces it would not matter. What if the String (and it does not have to be a filename) contained tabs rather than spaces. The real (and really only) solution to the problem is to put quotes around the argument, for the exact reason stated in my last post. -
Executing another program with command line arguments
I am very new to Java, so bare with me.
I have written an encryption/decryption program in C (that accepts command line arguments of the key, mode (encrypt/decrypt), and file), and I have written a GUI for it in Java. It accepts the filename (and has a button which opens the "File/Open" dialog), key, and mode, and has a button to Start the process of the encryption. I'd like for that "Start" button to call my encryption program in C (eep.exe) with the command line arguments of the file, key, and mode. This is what I have written so far :
Start = new JButton("Start");
Start.setBounds(150, 180, 90, 25);
Start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Desktop.open(new File("C:\\eep.exe" + " " + filename + " " + mode + " " + key));
However, I get the error "Cannot make a static reference to the non-static method open(File) from the type Desktop" on the Desktop.open command.
What should I do? Is Desktop.Open the right way to go about this? If not, what is the right way to go about it?
Thanks in advance.That has helped greatly, but I cannot pass command line arguments to it.
Using :
try {
Desktop.getDesktop().open(new File("C:\\eep.exe"));
catch (Exception e) {
System.out.println("Error executing.");
}I can execute eep.exe, but when I try to pass command line arguments to it, such as
Desktop.getDesktop().open(new File("C:\\eep.exe" + " " + filename));it fails, get caught and prints "Error Executing."
I have also tried loading the program, as well as some command line arguments into an array of strings :
String[] cmdArray = {"C:\\eep.exe", filename};
Desktop.getDesktop().open(new File(cmdArray));But it gives me the error "The constructor File(String[]) is undefined" on the
new File (cmdArray)part of the command. -
Need Help with command line arguments for a class method
Hey guys,
I'm fairly new to programming in java.
I want to a write a class method that adds up its command line arguments which are numbers. For example, if the input was .... 5 2 3....then the output would be 10.
I have been told to use the Convert to convert a string to a double. I'm ok for writing the class method but I have no idea how to use Convert and why I need it in the method.
Can anybody help please?Hey guys,
I'm fairly new to programming in java.
I want to a write a class method that adds up its
command line arguments which are numbers. For
example, if the input was .... 5 2 3....then the
output would be 10.Okay. So you would receive the numbers to add as the String[] argument to a main method. The steps are simple:
1) declare a variable for the count
2) for each String in the array:
2.1) extract the value as a double
2.2) add this to the count
3) output the resulting count
I have been told to use the Convert to convert a
string to a double.
I'm ok for writing the class
method but I have no idea how to use ConvertThere is no class Convert in the Java API.
and why
I need it in the method. Do you understand you need to somehow convert each String to a double (step 2.1)? Since Convert is unknown to me, maybe you should just take a look at class Double. It can help you do step 2.1, the rest should be trivial enough.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html
Give it a go and feel free to post back with a specific problem you are having, accurately described if you please :-) -
Changing the override file via command line arguments
Is there a way to change name of the file Coherence uses to override coherence-config.xml via a command line argument? I'd like to specify different override filenames in different environments.
I get the message that:
2006-02-13 16:53:27.699 Tangosol Coherence 3.0.1/317 <D5> (thread=main, member=n/a): Optional configuration file "/home/noah/tools/tangosol-config/tangosol-coherence-override-dev.xml" is not specified
I specified the following as the startup:
java -Dtangosol.coherence.override=/home/noah/tools/tangosol-config/tangosol-coherence-override-dev.xml -Dtangosol.coherence.log.level=5 -classpath /home/ncohen/tools/tangosol-config:/home/noah/tools/tangosol/lib/coherence.jar com.tangosol.net.CacheFactory
Where the tangosol-config directory contains my override file tangosol-coherence-override-dev.xml
If I change the name of the override file solely in the cmd prompt, it doesn't find any of them. It just gives me the optional configuration file ..... is not specified. How does one go about fixing this? Thx.
Message was edited by:
noah -
How to create and use library JAR files with command-line tools?
Development Tools -> General Questions:
I am trying to figure out how to put utility classes into JAR files and then compile and run applications against those JAR files using the command-line javac, jar, and java tools. I am using jdk1.7.0_17 on Debian GNU/Linux 6.0.7.
I have posted a simple example with one utility class, one console application class, and a Makefile:
http://holgerdanske.com/users/dpchrist/java/examples/jar-20130520-2134.tar.gz
Here is a console session:
2013-05-20 21:39:01 dpchrist@desktop ~/sandbox/java/jar
$ cat src/com/example/util/Hello.java
package com.example.util;
public class Hello {
public static void hello(String arg) {
System.out.println("hello, " + arg);
2013-05-20 21:39:12 dpchrist@desktop ~/sandbox/java/jar
$ cat src/com/example/hello/HelloConsole.java
package com.example.hello;
import static com.example.util.Hello.hello;
public class HelloConsole {
public static void main(String [] args) {
hello("world!");
2013-05-20 21:39:21 dpchrist@desktop ~/sandbox/java/jar
$ make
rm -f hello
find . -name '*.class' -delete
javac src/com/example/util/Hello.java
javac -cp src src/com/example/hello/HelloConsole.java
echo "java -cp src com.example.hello.HelloConsole" > hello
chmod +x hello
2013-05-20 21:39:28 dpchrist@desktop ~/sandbox/java/jar
$ ./hello
hello, world!I believe I am looking for:
1. Command-line invocation of "jar" to put the utility class bytecode file (Hello.class) into a JAR?
2. Command-line invocation of "javac" to compile the application (HelloConsole.java) against the JAR file?
3. Command-line invocation of "java" to run the application (HelloConsole.class) against the JAR file?
I already know how t compile the utility class file.
Any suggestions?
TIA,
DavidI finally figured it out:
1. All name spaces must match -- identifiers, packages, file system, JAR contents, etc..
2. Tools must be invoked from specific working directories with specific option arguments, all according to the project name space.
My key discovery was that if the code says
import com.example.util.Hello;then the JAR must contain
com/example/util/Hello.classand I must invoke the compiler and interpreter with an -classpath argument that is the full path to the JAR file
-classpath ext/com/example/util.jarThe code is here:
http://holgerdanske.com/users/dpchrist/java/examples/jar-20130525-1301.tar.gz
Here is a console session that demonstrates building and running the code two ways:
1. Compiling the utility class into bytecode, compiling the application class against the utility bytecode, and running the application bytecode against the utility bytecode.
2. Putting the (previously compiled) utility bytecode into a JAR and running the application bytecode against the JAR. (Note that recompiling the application against the JAR was unnecessary.)
(If you don't know Make, understand that the working directory is reset to the initial working directory prior to each and every command issued by Make):
2013-05-25 14:02:47 dpchrist@desktop ~/sandbox/java/jar
$ cat apps/com/example/hello/Console.java
package com.example.hello;
import com.example.util.Hello;
public class Console {
public static void main(String [] args) {
Hello.hello("world!");
2013-05-25 14:02:55 dpchrist@desktop ~/sandbox/java/jar
$ cat libs/com/example/util/Hello.java
package com.example.util;
public class Hello {
public static void hello(String arg) {
System.out.println("hello, " + arg);
2013-05-25 14:03:03 dpchrist@desktop ~/sandbox/java/jar
$ make
rm -rf bin ext obj
mkdir obj
cd libs; javac -d ../obj com/example/util/Hello.java
mkdir bin
cd apps; javac -d ../bin -cp ../obj com/example/hello/Console.java
cd bin; java -cp .:../obj com.example.hello.Console
hello, world!
mkdir -p ext/com/example
cd obj; jar cvf ../ext/com/example/util.jar com/example/util/Hello.class
added manifest
adding: com/example/util/Hello.class(in = 566) (out= 357)(deflated 36%)
cd bin; java -cp .:../ext/com/example/util.jar com.example.hello.Console
hello, world!
2013-05-25 14:03:11 dpchrist@desktop ~/sandbox/java/jar
$ tree -I CVS .
|-- Makefile
|-- apps
| `-- com
| `-- example
| `-- hello
| `-- Console.java
|-- bin
| `-- com
| `-- example
| `-- hello
| `-- Console.class
|-- ext
| `-- com
| `-- example
| `-- util.jar
|-- libs
| `-- com
| `-- example
| `-- util
| `-- Hello.java
`-- obj
`-- com
`-- example
`-- util
`-- Hello.class
19 directories, 6 filesHTH,
David -
How do I install XCode on Lion with Command Line and UNIX development support?
I installed Xcode via the App Store in Lion. I try to install Macports, latest relase but get this error messagE:
"Xcode is not installed, or was installed with UNIX Development (10.5+) or Command Line Support (10.4) deselected."
I am not presented with an option for selecting or deselecting different parts of Xcode, does anyone know how I can make sure I have these above
parts installed on Lion?where would it have put the installer? I goto /Developer/Applications and run Xcode and it says I have version 3.2.5(1760). I looked in Downloads and didn't see an installer.
-
Problem with command line argument files and quoted strings
I'm trying to use the following custom tag:
-tag com.me.Test.testTag:f:"My Test Tag"
This works fine when sent straight to the command line, but if I put it in an argument file (@argfile) along with the rest of my command, I get the following error:
javadoc: Illegal package name: "My Test Tag"
Any idea why this is happening? If I use a one-word tag header and omit the quotes, javadoc runs with no problems. I'm using Sun's SDK 1.4.1.
Thanks for your help!
Linda HowardWhite space is treated a bit differently in an @argfile,
to enable users to put packages or options on separate lines.
You might try escaping the spaces:
"My\ Test\ Tag"
or using a non-breaking space:
"My Test Tag"
What operating system are you on?
-Doug Kramer
javadoc team -
Create biar file with command line for link universe
Hi
I am using boxi 3.1 and I am trying to create 2 biar files with the command line
One file for " main" universe and it's reports and another is for a link universe and it's reports
The problem that on "main " biar file that been created , the link universe and it's reports also appear in it. Even so in the queries only the relevant objects are selected
I try to remove from the properties file the parameter 'exportDependencies=true ', and then when I check the xml of the biar I so that the link universe and it's report no longer appear. But when I importing the file I receive the error message 'Required dependencies not found on target system : '[ARgp0DCiBRBOsL3EHYQaHBY, AdfkNagAE59Nsbazh40nwTU]'
Does anyone have an idea what I need to do , in order to see in the main biar bust the main objects?I have done it before on BOXI R2 with the IW, and it works fine
But any how, this is the way that we have to work with, since it is part of a customer product and the link universe and it's reports is an additional part of the product.
So is there a way that I can pull just the main universe and it's reports?
Maybe you are looking for
-
AD permissions/Leopard 10.5.2/New Xserve
Hi all. I have a win2k AD which appears to be running normally, I have three DC and they all sync with each other so all is good. I have put in an Xserve running 10.5.2 and have successfully added it to the AD using Directory Utility. I have AFP and
-
I've just upgraded from 10.5 to 10.6.8 on a Mac Pro Dual-Core Intell Xeon, 2.66GHz. Is it possilbe to upgrade to Lion 10.7 with my Mac Pro Dual Core or have I just hit my ceiling on 10.6.8 update ?
-
Hi BW Experts, I was working on the Inventory Management screnario as in How to Handle Inventory Management Scenarios in BW with cumulative KFs. I read many of the forum postings but I am still little bit confused about the sequence of the loading. A
-
Mysql syntax in java help please!!
the below code works nice, but how do i place a variable in the VALUES part of the recordsUpdated statement. I can only place in numbers or letters but not variables. Lets say i want to loop this 20 times and i want it to write to the table 20 times,
-
Labview 8: continuous cursor in text box
Hi, I have made a basic instant messenger program with a text box that sends a message via a com port. When I press enter a "Send" button is operated and the string is sent, I then clear the text box. However to type another message the user has to c