• Post Reply Bookmark Topic Watch Topic
  • New Topic

cant execute jar file  RSS feed

 
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I export my Jar file with Eclipse. When I run in Eclipse everything is OK but when I execute the jar file cant works. It says me:

Please any help?
Many thanks and sorry for my english!
 
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
david luis wrote:
I export my Jar file with Eclipse. When I run in Eclipse everything is OK but when I execute the jar file cant works. It says me:

Please any help?


Basically, your jar file needs other jar files. And when you ran it outside of Eclipse, you didn't have these other jar files (specifically a JDBC driver) available.

Henry
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
david luis
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
david luis wrote:
I export my Jar file with Eclipse. When I run in Eclipse everything is OK but when I execute the jar file cant works. It says me:

Please any help?


Basically, your jar file needs other jar files. And when you ran it outside of Eclipse, you didn't have these other jar files available.

Henry


Yes but when I do a dir of these jar file I see the jar lib in the lib folder:
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Files in the "lib" dir wouldn't be in the classpath unless the manifest file of the app specifically pointed to it; does it?
 
david luis
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:Files in the "lib" dir wouldn't be in the classpath unless the manifest file of the app specifically pointed to it; does it?


These is my manifiest:

 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That explains it. You need a "Class-Path" entry that points to the jar file as well: see "Adding Classes to the JAR File's Classpath" in http://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
david luis wrote:
These is my manifiest:



see... http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
 
david luis
Ranch Hand
Posts: 53
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
Is strange so I generate the manifiest with eclipse automatically and I suppose that it generates the external libs in the manifiest
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
david luis wrote:
Is strange so I generate the manifiest with eclipse automatically and I suppose that it generates the external libs in the manifiest


When you export a jar file, Eclipse is under the assumption that it will run outside of Eclipse. In fact, it is very likely that it will be running on a different machine, with a completely different environment setup. In other words, there is nothing strange about it...

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!