• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt on packages with jar file  RSS feed

 
Martin Arun Paul Perumala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created two packages pack1 and pack2 in the root directory
C:\pack1;
C:\pack2;

I want to use a class in pack1 at run time inside pack2.So I created a jar file with pack1 class.My doubt is whether to create jar file at the root directory or inside pack2.Because when I am creating at the root directory run time exception(class no found ) is displayed.I set the class path for jar file too.
One more thing is I didnt use main function inside the class in pack1 package
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would probably create the JAR at the root directory and then reference it when you run the class under pack2 e.g. java -cp C:\path1.jar pack2main
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!