Here's an obvious one that took me a lot longer to figure out than I wanted.
I have a class (A) that uses another class (B) that sits within a jar.
To launch the class, I used :
java -cp full/path/to/B.jar:./ fully.qualified.name.for.A
I get the NoClassDefFoundError exception for B at the line where I try to instantiate it.
- Made sure the path to B.jar was correct
- Opened up the jar and made sure B was in there, in the correct directory.
Turns out that the jar had been made on Windows with a Manifest classpath in Windows format (C:\etc...) that didn't exist on the Linux machine I was trying the class on.
I rebuilt the jar, making sure the classpath was empty in the manifest, and instead referred to the classes that were in that earlier manifest classpath in the -cp argument.
Singapore To Use Driverless Buses 'From 2022'
15 minutes ago