This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError: org/springframework/context/ApplicationContext

 
Rohit Rai
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have just started working on springs and have done my first "Hello World" example. It is working fine - one place that i am getting stuck with is do i need to set the spring.jar and related jar's in my classpath in order to execute it from the command line?

The sample program works fine in Eclipse - but now i have made a jar and want to execute it from the command line and i am getting the following error - i tried to set the springs.jar to the classpath but its not working - what am i missing - [this is bugging ]

C:\>java -jar rohit.jar

 
Adam Koblentz
Greenhorn
Posts: 19
Java Mac OS X Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you're exporting the jar correctly?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you need the Spring jars in your classpath in order for it to find Spring classes.

And it is Spring. There is no pluralization of it. It is the Spring Framework.

Mark
 
Rohit Rai
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the inputs - yes we need to put the jar's in the class path
 
Rohit Rai
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way an update on this - i was using maven for the build ... so finally i figured a way out for this . while creating the jars put in all the dependent jars - i am not too sure if it's the correct approach but since the program that i was trying to do is a standalone one i thought of using it ... in pom.xml you can use the following plugin



and create the jar using



and execute as you normally do using
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic