Normally if we are working in windows and not using any IDE then we do open a command promt, compile a java program then run it...
suppose exactly samething i want to do it from a GUI just for me.. making a java program then entering the java file name in text field..getting it in my program then compiling and running.. the change is - i want to open a gui by running it from command prompt just once.. after that i enter the java file name..there is a compile and run button. the output which we see on command prompt i want to show it in text area..
I hardcoded the dir command and it worked.. but when i hardcoded javac and entered the java file name it didn't work..
There may be a no. of ways of doing it.. but i think this is one of them.
This is just practicing new things and i think its the way how we learn.
--In my code there will be one statement similiar to -
As i already specified i am not giving the class name for now..just want to get a flavour how it works..
So is it possible without invoking command shell if we running it in windows
Then how can we run the javac.exe if we are running the program in windows.
There may be another way but i have seen a lot of examples using the same way as in the current case.
please suggest.
For now i am not specifying the java file name -
String javac_exe_file = "C:\\Program Files\\Java\\jdk1.5.0_05\\bin\\javac";
String cmd = "cmd /C" + " " + javac_exe_file;
Runtime rr = Runtime.getRuntime();
Process p = rr.exec(cmd);
i am getting the below error while running the above code -
'C:\Program' is not recognized as an internal or external command,operable program or batch file.
Could somebody please tell me what needs to be done so that it takes C:\\Program Files\\Java\\jdk1.5.0_05\\bin\\javac as an single argument.
Also please can anyone provide me a web link where i can get the useful info related to above concept.
Oh my God.... what i was doing..
So i have written pattern inplace of param...
I checked the links but actual mistake is that you stated.
Its working now my friend.... Thanks a lot for all your help!!!
I tried it.. and that error is no more alive. Thanks a lot.
My app is runnig but its returing the null values for context/init param.
I am getting SAX.parse.exception.. init-param/context-param must be declared. But they are already.
I have checked few examples but couldn't find any clue. they have declared it same as i did.
Hi Balu,
I am using weblogic8.1.
interestingly my small app with below web.xml is running fine ..
I am not giving any specification here. Do you think its not correct?
Also when i checked the server logs its still throwing an exception which i mentioned before.
But when i am using init/context-param its not even running.
I am getting below error while deploying the application -
Deployment descriptor "web.xml" is malformed. Check against the DTD: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'web-app'
below is my xml file -
please let me know what is missing above as below xml is running fine -