Java Web Start for Cranktrain Simulation

I have put out a Java web start version of cranktrain simulation for a while. The tricky thing about Java web start is loading a data file. After reading all the available document on the web (which is very little), I learned that ClassLoader is necessary to invoke files in the JAR file.

ClassLoader cl;

crankShape = Trimesh.loadObj(cl.getResource("images/crank.obj"));

I used Java3D ObjLoader class to load the OBJ files. However, I am still confounded about how to directly read a text file in a web start app. The combustion force file was stripped from the current web start version of the crank model until I figured out a way to do it.

Comments

Yung-Chang Tan said…
Since the load method of ObjFile works fine with a URL argument, I finally gained access to Java3D source code to look into the implementation.

reader = new BufferedReader(new InputStreamReader(url.openStream()));

This code seems to be working.