• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Run java class that lives in .ear  RSS feed

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have a main inside one of my java classes. It is packaged in a jar(test.jar) and that jar is placed in an ear(test.ear). The ear is deployed to the server.

Now I want to run that classes main by using the ear in my classpath. I know that if I just used the jar I could get to that class but the jar is in the ear already and I don't really want to put the jar in two places.



java -cp $JBOSS_HOME/server/all/farm/test.ear com.test.SomeTest

When I do this I get the dreaded class not found error.

Anyone have a good way to say "come on java just look at all the .jar(s) in the ear archive to find that class.
 
author
Sheriff
Posts: 23601
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Unless this is a new feature just added to Java, you can't do it. You have to extract the files in the EAR file, so that you can have access to the JAR files...

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!