Forums Register Login

java app work from IDE but generate runtime error from command line

+Pie Number of slices to send: Send
Hi,

I am using Netbeans IDE to complie and run NyARToolkit which uses the java3d,JMF libraries. It is compiled with some warning for the use of deprecated API







I can run the sample application form the IDE but when I made an executable jar or tried to run the code from commandline, I am getting an error.



The same error is thrown in the IDE too when the jmf library was not added as an external library. In the executable jar, the manifest file is having the main class info and the library path info. Since that was not working I tried to invoke the main java class from commandline. I tried to set the class path environment variable to point the jmf library file but still getting error.

Any idea what could have gone wrong?

Thanks,

Mamatha
+Pie Number of slices to send: Send
Both error messages are pretty self-explanatory.
You ought not to use deprecated API. Look up the methods you are using, and it will suggest alternative.
You are attempting to get the first member of a 0-length array. If you look up the Vector API (why are you using Vector at all?) it will give more details.
+Pie Number of slices to send: Send
And welcome to the Ranch
+Pie Number of slices to send: Send
Hi,

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.

+Pie Number of slices to send: Send
Well done sorting it out
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1319 times.
Similar Threads
What is -Xlint in compiling java program?why this is done?
org.apache.poi.hssf
HelloManager1.java uses or overrides a deprecated API.
how to download org.apache.commons.logging API as it is not present in struts-doc.war
-Xlint error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 05:36:46.