Problem and question: Java webstarted app looking for its classes in base folder instead of ./lib.
As suggested in similar question at Java Web Start applications a
Thanks everyone for suggestions. It was Andrew hint to 'index the jars' which pointed me to the right direction...
Namely, the jars (produced my current IDE of choice, Netbeans) were indexed. However, the META-INF/INDEX.LIST within the main jar contained the references to other jars as if they were in current folder, next to the main jar.
JarIndex-Version: 1.0
WebStartSample.jar
webstartsample
SampleJavaLibrary.jar
newpackage
That resulted in jnlpClassLoader(), using the main index, and looking for jars in codebase url, while they actually resided under ./lib url subfolder.
This is how the correct index (recreated manually) looks:
JarIndex-Version: 1.0
WebStartSample.jar
webstartsample
lib/SampleJavaLibrary.jar
newpackage
To make the problem worst, such webstarted application would not fail, they would just look for classes/jars in wrong places first, and then eventually find them, presumably already loaded bu jnlp loader as described in original question.
Briefly, this IS related to Netbeans build and packaging procedure.
My immediate fix was disabling the jar indexing, and that resulted in correct and minimal network traffic, and greatly improved application initialization.
To do it in Netbeans, go to Tools->Options->Miscellaneous->Ant->Properties and add jar.index=false
Proper fix would be to make Netbeans index the jar correctly but that is the another question.
Again, thanks all for suggestions.
ps.
The "mydebian.mydomain" hostname hints you are running on Debian, where OpenJDK is the default Java implementation.
The Sun Java WebStart implementation is not part of OpenJDK, so an alternative implementation is used. As Java WebStart does not have an official TCK there are subtle differences and even bugs in the OpenJDK implementation which needs to be found manually (as there is no official TCK).
I would suggest trying with a Sun JVM (e.g. on Windows) and see if the behaviour changes.
Recommendations:
package
element for each Jar. This element is mentioned in the Resources section of the JNLP File Syntax (also expanded in the table at the top of the page). Chase the link in the page to the (downloadable only) API Specification for further details of the package
element. And as an aside, the API Spec. is the single best resource on JWS. I wish Oracle would make it web-browsable.