How to execute a Command Prompt command from J2SE code executing on Windows
How to execute a Command Prompt command from J2SE code executing on Windows??
Please help me
[http://java.sun.com/docs/books/tutorial/getStarted/]
~
Similar Messages
-
How do I transfer iTunes 10.5 from old computer to new windows computer
How do I transfer iTunes 10.5 from old computer to new windows computer music and videos?
do not transfer.
properly install acrobat xi pro onto your new computer. installation files are linked below.
if you no longer need acrobat xi on your old computer, open it and click help>deactivate. then uninstall. make sure you have your serial number before doing this.
Downloads available:
Suites and Programs: CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
Acrobat: XI, X | 9,8 | 9 standard
Premiere Elements: 12 | 11, 10 | 9, 8, 7
Photoshop Elements: 12 | 11, 10 | 9,8,7
Lightroom: 5.5 (win), 5.5 (mac) | 5 | 4 | 3
Captivate: 8 | 7 | 6 | 5
Contribute: CS5 | CS4, CS3
Download and installation help for Adobe links
Download and installation help for Prodesigntools links are listed on most linked pages. They are critical; especially steps 1, 2 and 3. If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'. -
How can i transfer back up contact from desktop pc working on Windows 7 to iphone 5 working on ios 8.1?
You can't restore to a backup that was taken on a device which has a higher version of iOS than on your iPad, you will have to update your iPad to 8.1.3 to be able to restore to it
You should be able to update your iPad via Settings > General > Software Update -
How to send SMS ( Short Message Service ) from java code
Hi
How to send SMS ( Short Message Service ) from java code.
Thanks
GauravDo you need to receive SMS? If you need to receive SMS, you will need to host your own GSM device or modem so that people can send you SMS.
If not, you can just use internet SMS gateways like clickatell as mentioned above will do the work, and post to them by HTTP, XML or email. The cost is about 6-8 cents per SMS. There are cheaper services, but not always reliable. If you need to host your own GSM device, you can use software like http://www.kannel.org (GPL Open Source) or http://www.visualgsm.com. Alternatively, you may obtain a shortcode from your Telco - but these come with monthly subscription of maybe one or two hundreds.
Regards,
Joshua
<SMS Gateway>@Expert -
How can I get my photo's from my iphone on my Windows computer?
How can I get my photo's from my iphone on my Windows computer?
you connect it by usb cable
you go into my computer
you clikc on the iphone which show up as a camera there (if you installed Itunes)
then you navigate to the picture folder and copy out the photos you want from camera roll -
How can i print all the contect of the code in sapscript window ? ?
how can i print all the contect of the code in sapscript window ? ?
Hi,
Do you mean that you want to print the ABAP code to SAPscrip form ?
Svetlin -
Command prompt issue from VBscript
So I have this script that works perfectly for parsing out a COM number and then sending data to said COM port via the command line (things like 'ipconfig > //./COM15'). The issue is that it only works when I use the /K modifier which tells the command
windows to stay open. I don't want them to stay open, but whenever I remove the /K, it doesn't work. Nothing gets copied to the COM port. I suspect the cause of this is the command prompt closing before things like systeminfo can finish running. So is
there a way to have the command prompt window stay open for a short amount of time and then close?
'Part 1: FindCOM port
fileName = "C:\rtlstuff\COM.txt"
Set regex = New RegExp
regex.Pattern = "COM(\d+)"
regex.IgnoreCase = True
regex.Global = True
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(fileName)
text = file.ReadAll()
file.Close
Dim ComPort
Set matches = regex.Execute(text)
For Each m In matches
ComPort = m.SubMatches(0)
Next
'Part 2: Set file dictionary
set oDic = CreateObject("Scripting.Dictionary")
oDic.Add 0, "ECHO %DATE% %TIME% > //./COM"
oDic.Add 1, "ipconfig > //./COM"
oDic.Add 2, "systeminfo > //./COM"
v = 3
'Part 3: Set COM Variables
Set oShell = WScript.CreateObject ("WScript.Shell")
MODE = "MODE COM" & ComPort & " 9600,N,8,1,P"
oShell.run "cmd.exe /C" & MODE
'Part 4: Data transmission
Dim Command
x=0
do while x < v
Command = oDic.Item(x) & Comport
msgbox Command
oShell.run "cmd.exe " & Command
x=x+1
wscript.sleep 10000
loopCan you help me with syntax? I'm still not hugely familiar with VB and I'm not sure how to set this up. This current iteration does not work.
'Part 1: FindCOM port
fileName = "C:\rtlstuff\COM.txt"
Set regex = New RegExp
regex.Pattern = "COM(\d+)"
regex.IgnoreCase = True
regex.Global = True
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(fileName)
text = file.ReadAll()
file.Close
Dim ComPort
Set matches = regex.Execute(text)
For Each m In matches
ComPort = m.SubMatches(0)
Next
'Part 2: Set file dictionary
set oDic = CreateObject("Scripting.Dictionary")
oDic.Add 0, "ECHO %DATE% %TIME% > //./COM"
oDic.Add 1, "ipconfig > //./COM"
oDic.Add 2, "systeminfo > //./COM"
v = 3
'Part 3: Set COM Variables\par
Set oShell = WScript.CreateObject ("WScript.Shell")
MODE = "MODE COM" & ComPort & " 9600,N,8,1,P"
oShell.run "cmd.exe /C" & MODE
'Part 4: Data transmission
Dim Command
i = True
x=0
do while x < v
Command = oDic.Item(x) & Comport
msgbox Command
oShell.run "cmd.exe " & Command , ,True
x=x+1
wscript.sleep 10000
loop -
How to run a command prompt " command " through java code
hi all,
There is a command
"java -jar selenium-server.jar -interactive"
which i am running through command prompt after going to D:\MyFolder\Examples .
i want to execute this command using java code .please helpThis has already been answered in your other two threads on this topic - http://forum.java.sun.com/thread.jspa?threadID=5221221&messageID=9898287#9898287 and http://forum.java.sun.com/thread.jspa?threadID=5221223&messageID=9898290#9898290.
For some reason you don't want to read the reference that tells you exactly how to do what you want and how to avoid the pitfalls - http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . -
Runtime.exec() I need to run a command prompt command from java.
the code i have that doesn't seem to work is:
String driveloc = System.getProperty("user.dir").substring( 0, 1 );
String path = jTextFieldPath.getText();
String path2 = jTextFieldPath.getText().substring(0, jTextFieldPath.getText().length()-3) + "lst";
String[] cmd = { "cmd.exe", "/" + driveloc, "ASMtools\\AS11 " + path + " -L >" + path2};
txt_mf.append( cmd[3] );
try {
Process np = Runtime.getRuntime().exec( cmd );
catch( java.io.IOException ioe) {
//error
}jTextFieldPath.getText() contains the path of the file saved by my program.
the line of code i am trying to run is:
AS11 FILE1 -L FILE2this line compiles the asm file and converts it to a lst creating an s19 file in the process. AS11 is an exe that aids the command prompt much like javac.
If you could help me figure this out it would be great.
Thanks in advance,
-JukeString driveloc =
System.getProperty("user.dir").substring( 0, 1 );
String[] cmd = { "cmd.exe", "/" + driveloc,
"ASMtools\\AS11 " + path + " -L >" + path2};Are you sure you want to invoke cmd.exe with the switch /c or /d or whatever depending on System.getProperty("user.dir") ?
Starts a new instance of the Windows 2000 command interpreter
CMD [A | /U] [Q] [D] [E:ON | /E:OFF] [F:ON | /F:OFF] [V:ON | /V:OFF]
[[S] [C | /K] string]
/C Carries out the command specified by string and then terminates
/K Carries out the command specified by string but remains
/S Modifies the treatment of string after /C or /K (see below)
/Q Turns echo off
/D Disable execution of AutoRun commands from registry (see below)
/A Causes the output of internal commands to a pipe or file to be ANSI
/U Causes the output of internal commands to a pipe or file to be
Unicode
/T:fg Sets the foreground/background colors (see COLOR /? for more info)
/E:ON Enable command extensions (see below)
/E:OFF Disable command extensions (see below)
/F:ON Enable file and directory name completion characters (see below)
/F:OFF Disable file and directory name completion characters (see below)
/V:ON Enable delayed environment variable expansion using c as the
delimiter. For example, /V:ON would allow !var! to expand the
variable var at execution time. The var syntax expands variables
at input time, which is quite a different thing when inside of a FOR
loop.
/V:OFF Disable delayed environment expansion. -
Running command prompt externally from Java
Hi,
Does anyone know how to make a Java program that opens up the command prompt and runs certain commands? Thanks,
AdamRead this before you use it:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html -
Problem in executing command prompt commands through application
Hi,
I am facing issue in executing commands through VC++ application.
My application is a dialog based MFC application in VS2008.
I want to execute below commands programmatically.
devenv D:\TestApp\TestApp.sln /rebuild release
devenv D:\TestApp\TestApp.sln /rebuild debug
But I am not able to set the current directory path as "D:\TestApp\" programatically.
Through which API I can execute multiple commands on command prompt programmatically same as we do manually on cmd.
Please Help.
Thanks in Advance.
Thanks & Regards, Mayank AgarwalI want to execute below commands programmatically.
devenv D:\TestApp\TestApp.sln /rebuild release
devenv D:\TestApp\TestApp.sln /rebuild debug
But I am not able to set the current directory path as "D:\TestApp\" programatically.
Through which API I can execute multiple commands on command prompt programmatically same as we do manually on cmd.
Why can you "not able to set the current directory path as "D:\TestApp\" programatically"? Are you forgetting to escape the backslashes?
Why to you need to set the current directory anyway?
What is the problem with executing multiple commands?
As to your basic goal, have you looked at
system()
ShellExecute()
ShelExecuteEx()
CreateProcess()
? Perhaps you should show us what you have tried.
David Wilkinson | Visual C++ MVP -
I know that while I use the command prompt in windows to execute java application, I cannot use the other windows commands such as
ipconfig,
telnet...
etc
Is there anyway where I can use the java commands (javac, java) AND the other regular commands??The problem is happening because the PATH variable
settings is not proper.
Go to the environment variables in your machine and
append the following to the PATH environment
variable
%SystemRoot%\system32;%SystemRoot%;Save and then open a new command window and try.Yep, you were right.
I did that to the user's path and it worked after I appended it. It works for both now,
thanks. -
How to modify an existing xml file from java code.
Hi
I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
For example if xml file(studlist.xml) is as below:
<?xml version="1.0" encoding="UTF-8"?>
<StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
<Student>
<Name>ram</Name>
<Age>27</Age>
</Student>
<Student>
<Name>sham</Name>
<Age>26</Age>
</Student>
</StudentList>
Now suppose i have set name to victor using student.setName,
and set age to 20 using setAge from javacode,
the new xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
<Student>
<Name>ram</Name>
<Age>27</Age>
</Student>
<Student>
<Name>sham</Name>
<Age>26</Age>
</Student>
</StudentList>
<Student>
<Name>victor</Name>
<Age>20</Age>
</Student>
As observed this is not a valid xml file.But how can i modify without any errors?I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
// gets the root element of the specified file (code not shown)
Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
// write a new student element
Element student = document.createElement("Student"); // creates the new student
rootElement.appendChild(student); // ***appends it to the root element***
Element name = document.createElement("Name"); // creates the name element
name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
student.appendChild(name); // appends the name to the student
Element age= document.createElement("Age"); // creates the age element
age.appendChild(document.createTextNode("26")); // adds the age text to the age element
student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM -
How to access an object's variable from native code
i am passing an object in a native method.i have to change the value of the object's variable.how do i access the variable of object and assign it new value from c++ code.when i try to access it i get a message that the variable must have a class/sruct/union type.
pl. help.I'll tell You if You send me the structure of this object in Java. And a name of field what are You thinking about.
Maciek -
How to click a HTML page button from Java code?
Know the HTML page name and the button id in this page, how to click the button automaticly in java code(Like in awt or swing)?
ukkus wrote:
Hi,
Thank for the quick reply,
It will be very helpful if you can tell me how can we do this, I am not able to get how to do the same, with the link that you have provided.You haven't even had time to read it yet.
>
Actually main scenario is:
I have to RUN a JSP report which will call this script. That JSP report and script is in UNIX server. Can you please explain how to perform this task.Running this from a JSP is an even worse programming practice than running it from a standalone application.
Maybe you are looking for
-
WebLogic Server 9.2 MP1
Hello, I am trying to download/install WebLogic 9.2 MP1 (as it is required, and is a prerequestie). My OS is Solaris 10 x86 64-bit. On the Oracle download page, when I select my operating system corresponding to WebLogic Server 9.2 MP1, I am lead to
-
SharePoint 2013 Development Environment for Devolopers
Hi All, What is the system requirements for developing and deploying web-parts in SharePoint site for developers? we are getting above error when trying to deploying web parts from local machine, our local machine configuration in win 7 with visual s
-
IDML file crashes InDesign. INDD CC file opens fine
I created a file in Indesign CC. Saved as .indd and as .idml. The .indd files opens fine, the .idml file causes Indesign to crash. No errors, just a long wait, then a forced quit. InDesign is up to date. Created a new document, copied and pasted docu
-
Have just installed new HP 2311x display withe 4 year old MacBook. VGA cable. In mirror mode, at high resolution of 1920x1080, image size on HP display is too small. How can I get it to fill screen? If not in mirror mode, the display looks good, only
-
Add items to gvfs database?
gvfs-mime --query x-scheme-handler/http and gvfs-mime --query x-scheme-handler/https both output Default application for 'x-scheme-handler/https': firefox.desktop Registered applications: firefox.desktop Recommended applications: firefox.desk