Manoj Garg

Ranch Hand
+ Follow
since Jun 21, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Manoj Garg



Okey.. It seems i should clear the picture..

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.
16 years ago
I am trying to complile and then run the program.
I have seen that by using below code we can get the output of it.

Runtime rr = Runtime.getRuntime();
Process p = rr.exec(cmd);

Then we catch the result using Input Streams.. Is my approach not right?
16 years ago

My aim is to run a java program from another one.

--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
16 years ago
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.
16 years ago

In that case, command will be --- cmd /C "C:\Program Files....\...\javac"
here is my code -

16 years ago

But this is printing it as below -

these double quotes shouldn't be there.
16 years ago
Hi,

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.

Thanks
16 years ago
absolutely right... i will keep this eye always active now..
16 years ago

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!!!
16 years ago
Balu, Here is my web.xml -



Thanks
16 years ago

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.

16 years ago

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.

Thanks

16 years ago
Please ignore as this is a duplicate.
16 years ago
Hi,

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 -



Thanks
16 years ago