Calling a dos shell with a servlet
I am using the code below to call a dos shell using a servlet. will you please tell what is wrong with my code. thank you.
public class ResponseServlet extends HttpServlet {
public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
PrintWriter out = response.getWriter();
// then write the data of the response
String username = request.getParameter("username");
if ( username != null && username.length() > 0 ) {
Runtime rt = Runtime.getRuntime();
rt.exec("C:\\WINNT\\system32\\CMD.EXE");
public String getServletInfo() {
return "The Response servlet says hello.";
Response code 503. "Service unavailable". Sounds like a server configuration issue.
Similar Messages
-
How to call a dos shell from a servlet
How could I call a dos shell using a servlet so that java files could be compiled and the results be seen without having to call the browser each time? thanks for your kind attention. amaral
I guess this might help....
In one of your servlet classses create a runtime process and execute a command( the path to javac and the file to be compiled) wait for the process to finish a get the result and send it to the client.
- XL -
Calling a DOS command with LabVIEW
Is it possible to run commands that you might execute on the DOS prompt from
labview?
-- StephenWell at least you did a search- the thread you replied to is 7yrs old! please start a new thread
Jeff -
I am trying to spawn a DOS Program from within Java.
On Win95/98/ME, I use
Process p = Runtime.getRuntime().exec("START /w command.com con /c myDOSProgram.exe");
This works on these platforms. On Win 2000, I use
Process p = Runtime.getRuntime().exec("START /w cmd.exe con /c myDOSProgram.exe");
It does not work at all.
I have tried all combinations of using START, cmd.exe, con /c, etc.
I can spawn a Windows App using
Process p = Runtime.getRuntime().exec("windows.exe");
And it works fine.
What does it take to spawn a DOS program from Java on the Windows 2000 op sys?Hi. I recently wrote a java GUI that calls a DOS program with mixed success. Here's the code I used to make the call:String osName = System.getProperty("os.name" );
String[] cmd = new String[4];
if( osName.equals( "Windows 2000" ) || osName.equals( "Windows NT" ) )
cmd[0] = "cmd.exe";
cmd[1] = "/C" ;
cmd[2] = "VBDoc.exe";
cmd[3] = fileName;
else if( osName.equals( "Windows 95" ) || osName.equals( "Windows 98" ) )
cmd[0] = "command.com" ;
cmd[1] = "/C" ;
cmd[2] = "VBDoc.exe";
cmd[3] = fileName;
else
System.out.println(osName);
Process proc = runtime.exec(cmd);Check out this article, it gives a good explanation of how to use the exec() call:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Hope this helps! -
Is it possible to call ms-dos command in abap program?
Hi,
is it possible to call ms-dos command in abap program?
Thanks.Hi Cemil,
You probably have your answer here:
[Re: DOS/Windows command in app server;
You create your external command with SM69 (you can test it with SM49).
Then you call this command with function module "SXPG_COMMAND_EXECUTE".
(See function group SXPT for all the calls to external commands).
Regards,
Thomas -
Joystick problem in DOS Shell under Windows XP
(I had previously posted this in another forum on the Internet, copy 'n' pasted here to save me a bit of typing) I can't seem to to get my joysticks and/or gamepads functioning in a DOS shell under Windows XP. Initially I was trying to run Death Rally under 'DOSBox', and couldn't get the game to recognize my Gravis Gamepad. At first I thought the problem might be with DOSBox, but then realized that the gamepad wasn't recognized under a simple DOS shell as well. I have a P4 2.66ghz CPU, running Windows XP Pro w/SP2, with a Sound Blaster Li've Value CT4780 that has a standard gameport on it. I can calibrate the gamepad within Windows XP and it appears to be working fine (my MIDI keyboard works fine as well, it uses the gameport of the sound card too). In a DOS shell (as well as under DOSBox), the gamepad isn't recognized at all. I tried several DOS games (e.g. DOOM/Duke 3D/Death Rally/Stargunner/etc...), as well as a little QBasic joystick tester that I had whipped together years ago... no dice, the gamepad isn't recognized under DOS (or DOSBox); even though in Windows XP (in the 'Game Controllers' applet in the control panel) it works just fine. Windows games work fine with the gamepad, but nada in a DOS shell or DOSBox. Note that I had never previously checked if the gameport and/or joysticks were working on this PC under DOS, I just discovered it the other day. Any ideas? Any help would be much appreciated (edit) P.S. One thing that I just tried: I booted from a flash dri've to W98 DOS and loaded the SBLi've DOS drivers. The gameport/gamepad works fine like this (with my JoyTest utility, as well as the gameport being reported in MSD). So, I'm sure that the gameport and gamepad is woking under nati've DOS, it simply isn't recognized in a DOS shell under Windows XP. ('nuther edit) In Windows' device manager, the gameport is listed as 'Creative Game Port', with I/O address of DF08-DF0F. The 'Use automatic settings' checkbox and 'Change setting' button is grayed out, so's I can't piddle with those settings. In the old(er) DOS/W9x days (with standard non-PNP hardware) the standard gameport address was (what was it's) 200 (maybe 20?). Could this be the problem, that the Creative Game Port I/O address is set for an obscure address (that I can't seem to change)? Maybe there is a way to change it to a standard setting? 7
thank you very much
-
How to replace an MDB with a servlet
I got a situation to replace an MDB with a servlet,How can I do that,more appreciated if u send me some sample code.
Hi,
An MDB can be replaced by a normal java class by doing the following.
Make a jndi lookup for the queue/topic connection factory and then create a javax.jms.QueueConnection. Then create a javax.jms.QueueSession using this connection. Make a JNDI look up for the Queue. Create a javax.jms.QueueReceiver using the created QueueSession. Call start on the QueueConnection and receive a message by calling the receive method on QueueReceiver.
Thanks,
marvlex -
How to get DOS shell's screen dimension ?
Hi all!
For GUI -->
It is possible to get the dimensions of the screen you are using by creating an object of class Toolkit and calling its getScreenSize() method. This returns the width and height as fields in a dimension object. The pattern is
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;
For DOS shell in Windows -->
How can I do ???
Help me!
Long NguyenDon't think you can. Anyway, in my Windows 2000 system I can stretch the DOS window vertically, and sometimes it gets a scroll bar -- what is the "height" of such a thing?
-
Can an applet call one of the methods of servlet??
hi everyone...
i m very new servlet and applet programming and i have come accross a problem....
i m using a applet which establishes connection with the servlet(residing on server)..i want to use few of the methods of the servlet....
now is it possible tfor me to call the methods of this servlet using its object.???
please help me..
thanx in advancefirst of all thanx a lot for the reply...
but i wanted to know can an applet call any other
function of servlet other than get and post....as i
hacve defined some more functions in servlet..
please reply...I did this a while back (2003/4?) and unless it's changed you cannot do it directly, it must be GETor POST, then you could just use conditional logic to invoke another method. -
Calling webservice in SAP XI from Servlet
I have requirment of Calling webservice in SAP XI from Servlet.
COuld you provide information of caling simple webservice from servletHello Venkat,
Getting Started with Web Services
Web Services Infrastructure
Getting Started with Web Services [original link is broken]
Thanks,
Satya -
Applet communication with struts servlet
Hi
I�ve seen a lot of examples where a Java applet communicates with a servlet.
I�ve made a web application using Struts, and i would like to know if it is possible to use an applet (View) and send to Stuts some data, I mean, call an action like http://localhost:8080/ViewRoads.do.
Is it possible? ,Where can I find some examples about?, could anyone explain how would it work?, any good book to read about?.
Thank you.I'm sorry but don't you have a communication source code example between a servlet and an applet that does work ? I'm looking for one of these since Two days already.
thanks -
Open pdf-file in dos-shell at specific page
Hi
do andybody know since which version of Adobr Reader the command <path to Acrobat> /A "<open parameter>=OpenActions" "<path to PDF file>" for DOS-shell is available??
Because i wanna use this command on a system with Adobe Acrobat 4.0 and 5.0 .
If there is an other solution to open the file at a specific page from DOS shell please tell me .
I am looking forward to your answers
best regards
MarcoThanks for the answer
Is there anybody from the staff ?? I think they know it -
Calling an external shell script program from ABAP.
Hi,
Can i call an external shell script program from abap which is there on application server.
The FM WS_EXECUTE i know can be used for calling this purpose.
But i am getting a doubt that how can i call the external program from there.
Please clear my doubts.
Thanks in advance.
Vikashsearch in SCN for sm49 and sm69 Tr. you will surely find solutions for it, with a simple search.
-
Inconsistent result when running in c# and running in dos shell
Hi,
I ran the following script in the MSDOS prompt and it worked fine and I get the string value:
But if I run it in c# with this routine:
cmd = "cscript"
arg = "/c RemoteReadReg.vbs " + computername + keypath;
PInfo = new ProcessStartInfo (cmd, arg );
PInfo.UseShellExecute = false;
Process = Process.Start(PInfo);
Process.WaitForExit();
The vb return with the error : script runtime error: Type mismatch in the line
Wscript.Echo strValue
Do you know why the behaviour is different when run in dos shell as opposed to running in c#?
RemoteReadReg.vbs
Dim objArgs: Set objArgs = WScript.Arguments
Dim strComputer: strComputer=objArgs(0)
Dim strUser, strPassword
Dim objSWbemLocator, objSWbemServices, objReg
Dim strKeyPath: strKeyPath = objArgs(1)
Dim strEntryName
If (objArgs.length > 2 ) Then
strEntryName = objArgs(2)
End If
Dim strValue
Const HKEY_LOCAL_MACHINE = &H80000002
strUser = strComputer & "\user"
strPassword = "password"
Set objSWbemLocator = CreateObject("wbemScripting.SwbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer _
(strComputer, "root\default", strUser, strPassword)
Set objReg = objSWbemServices.Get("StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, strValue
Wscript.Echo strValueSince the error occurs in a VBS script you should ask in a scripting forum, for example here:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG&filter=alltypes&sort=lastpostdesc
As far ProcessStartInfo is concerned I don't see an issue except a (probably) stray /c argument, cscript doesn't have such an option.
The real question is why do you even bother with this script? Same information can be obtained via C#, see here for an example:
http://stackoverflow.com/questions/1155633/how-to-obtain-a-registry-value-from-a-remote-machine-if-i-dont-know-its-type
It's more complicated because it tries to deal with every registry value type but if you only care about string value you can simplify that code a lot. -
Call a UNIX shell script from an oracle stored procedure
We need to call a UNIX shell script from an oracle stored procedure
i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?There are various ways in achieving this.
For Example, you can call a PRO*C-Library residing on the database server.
This requires a PL/SQL library to be generated and some changes to the Listener configuration.
It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
Be careful with this, because it really works ;)
Refer to :
http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
Message was edited by:
user434854
Maybe you are looking for
-
Sharepoitn 2013 - Office Web Apps Licensing
Dears, I do have the license key with me for the office web apps 2013. The office web apps are working with our SharePoint 2013 portal without any issues. We were able to view the documents but couldn't edit the documents which are hosted in our port
-
Im looking into getting a macbook pro...
And I'm wondering if i wanted to get Fallout 3 and Tes 4 with it what kind of hardware will i need to run them and to anyone that does play those on a macbook pro how well does it run. Sorry if this topic dosen't belong here Message was edited by: Al
-
Hi. I'm developing an enterprise app in Xaml where I capture a signature using the InkManager control in windows 8.1, the user can print the document from the device just fine with the signature, but the document is sync back to the server and from
-
Fault recording two programmes
Hi, I'm having an issue recording on my Sky+HD 2TB box, when trying too record a programme that's already got something else planned to be recorded at the same time my box previously added it to the planner and if you would try to record a third prog
-
I did not charge my ipod for a month but after charging for a night i cannot turn it on?
i can't boot it . even after charging for whole night