• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Mamatha Achuthan
Greenhorn
Posts: 8
Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Marshal
Posts: 56522
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Marshal
Posts: 56522
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
Mamatha Achuthan
Greenhorn
Posts: 8
Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Campbell Ritchie
Marshal
Posts: 56522
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done sorting it out
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!