Thanks for the reply. After spending hours on the code, finally I could make out that the problem was with the class path. The program was using Java Media Framework and related code which was deprecated. (JMF was not developed since 2002, the generic code based on JMF was deprecated.) When JMF was installed in the system, it has automatically set the classpath environment variable in the MSDOS path format. When I tried to compile the sample code from IDE, I added the JMF jars to JRE /ext/lib -a bad practice, for which I paid the penalty. The JRE has the JMF jars, so it did not throw any compile time errors or missing library error. When I tried to run the program from IDE, it failed, and threw a run time error as in my last post. Then I added the library jars as external jars thus fixing the problem. I successfully run the application.
The same happened when I tried to make the same application an executable jar. Then I tried to run it from the command line and got the same error. setting CLASSPATH environment variable didn't help. I dont know why. Finally when I specified, 'classpath' (absolute path to jars )option with java command , it worked.