How to avoid "cannot execute" issue with a runnable jar file?

I am trying to understand why the runnable jar file runs on one Unix server, but not the other with same environment settings.

I copied exact same test jar from here -->
http://www.javaworld.com/javaworld/javatips/javatip127/MakeJarRunnable.zip

on to both Unix servers. Then changed permission on the jar to have execute permission to user.

I am able to execute it on serverA. But on serverB it fails. I checked JDK version, ksh version, tty, path, classpath settings all of them are same on both servers. It does not appear to be a DOS end-of-line character issue with manifest file. I am able to execute a test.sh script that has a simple echo with ^M character at the end of line with just -> $>./test.sh on both servers.

 
serverA/$>./myjar_r.jar
ksh: ./myjar_r.jar: cannot execute
 
-rwxr-----   1 xxx   yyyy     705 Nov 19 21:55 myjar_r.jar
 
serverA/$>Version M-11/16/88i
 
serverB/$>./myjar_r.jar
Hello, Runnable World!
 
serverB/$>Version M-11/16/88i

Could you try to execute that jar on your end and see if you could figure out what could cause it not to execute?

BlackDog: Programming => Tips => JAR run

http://www.javaworld.com/javaworld/javatips/javatip127/MakeJarRunnable.zip

What systems are ServerA and ServerB?

I wouldn't have expected JAR files to be directly runnable on any UNIX system. They execute files based on header bytes, not file extension associations.

serverA, serverB both are running Solaris8, JDK1.4.2_04.

Yes general understanding is you can't execute jar files directly. But that is not true from JDK1.2 on words, apparently both windows and Unix do recognize .jar associated with java and execute the class with main method specified in manifest file.
This article explins how that happens..> http://www.javaworld.com/javaworld/javatips/jw-javatip127.html?page=1

I also gave proof in my post that "myjar_r.jar" jar file is getting executed on serverB, but not on serverA.
Since test jar file is available on the net, anyone can test it.

I did check other things like how Unix file associations work using -->
/etc/magic,
/usr/dt/appconfig/types/C/datatypes.dt. I did check if this has something do with PATH, CLASSPATH settings or tty setting etc.. Bu all these settings look same on both servers.
That is why this problems looks very interesting and challenging.

Proving serverb runs it while servera can't without actually saying what they are isn't too useful, serverb could have been a windows machine running jars in cygwin for all I knew -- which I actually suspected because you linked Windows instructions as if they were relevant...

Knowing you have solaris is good, and makes sense to a degree. You'd expect a Sun OS to support Java if anything did.

I know for a fact it doesn't work on my Linux system but that's not at all relevant. Linux isn't Solaris. Getting it working in mine would probably mean playing with "MISC binary support" in the kernel.

You might want to get this moved to the Solaris forum so people who know Solaris internals notice this.

How can I move this thread to Soarlis Forum?

moved.