The Premise
- Me and my colleague created a very simple MAVEN+SPRING project with a Main Class.
- Used maven-exec-plugin to run the Main class and things worked perfectly fine
- mvn exec:java -Dexec.mainClass="com.foo.MainClass"
- Then came the primitive idea of using java to run the application with all the dependencies in the classpath. And we Java Junkies know it right?
- java -classpath "x.jar;y.jar" com.foo.MainClass
- For some reason the primitive idea of using java tool didn’t work.
- We stared at each other. Tried again. And again with quotes “”, other misc changes. But still didn’t work.
- Culprit (;)
- All this was done on a Linux Dev machine and we forgot to realize that the character ‘;’ is recognized as some mumbo jumbo(which I haven’t figured out yet) by bash/shell.
- Savior (:)
- After hours (consider man minutes) of researching the on Google, Tech forums, etc with lame key words, I resorted to look into some preinstalled java apps on linux and there it was – the solution to the misery, the light at the end of the tunnel, the answer to the problem, a savior in the form of a single character ‘:’
- Just erased the presence of the culprit ‘;’ and replaced it with the lord, the savior ‘:’ and Voila!, Eureka!, …. IT WORKED.
- java -classpath "x.jar:y.jar" com.foo.MainClass
- Understand the OS specific execution paradigms
- The classpath delimiter in Windows is ‘;’ and in Unix flavors, it is ‘:’
- Revisit the basics often
- Shit Happens
No comments:
Post a Comment