This isn’t a solution I like, BTW. The reason for doing it this way
is the usual culprit, Windows, because I haven’t found a better way
there yet. I’m still thinking about it, though, so this might change
soon.
Both your script and VASSAL.launch.Launcher are using a classpath of
lib/Vengine.jar. Inside the app bundle, there is no lib directory
anywhere - all the JARs are just in Contents/Resources/Java. I made
Contents/Resources/Java/lib a symlink to Contents/Resources/Java, and
the application now starts fine from a double-click. I can successfully
load a module and a saved game.
./VASSAL.sh
Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad
version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
Although you note that there isn’t any mention of Vassal classes in
the backtrace, there is some loading of classes, so it would appear
that the class that is being loaded is the one that has a bad version
number.
The results are the following. The number in […] is the range of
bytecode versions found in each archive. The association between
bytecode version and JVM version is show in the next table. Note in
particular that the Vengine.jar file uses bytecode from Java 1.6.
Maybe the compiler isn’t really following the manual specification.
It might be safer to specify “-target 1.5” as well as “-source 1.5” in
the compilation.
VASSAL.launch.Launcher is no more—I’ve replaced it with a method which
doesn’t require starting an additional JVM. This should at the same time
clear up the path issue you found.
Where should the ext and plugins directories go in the bundle? In
non-Mac installs they would be siblings of lib.
When you modify your heap sizes in the preferences, do you see those
changes show up in the Info.plist? (Or are you getting a stack trace
in the errorLog?)
Is there anything else which looks stupid that should be fixed?
OK. But the bundle below still lists VASSAL.launch.Launcher as the
Main class
in the Info.plist file
Not for me.
A little more machine background.
This is an Intel Core-2 duo processor, Mac OS X 10.5.1 (Leopard)
java -version
java version “1.5.0_13”
Java™ 2 Runtime Environment, Standard Edition (build 1.5.0_13-
b05-237)
Java HotSpot™ Client VM (build 1.5.0_13-119, mixed mode, sharing)
The error I get now is a NumberFormatException trying to parse integers:
1/29/08 2:57:36 PM [0x0-0x416416].VASSAL.launch.Launcher[24769]
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:497)
at VASSAL.launch.Launcher.main(Launcher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at apple.launcher.LaunchRunner.run(LaunchRunner.java:115)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
at
apple
.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:
52)
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:497)
at VASSAL.launch.Launcher.main(Launcher.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at apple.launcher.LaunchRunner.run(LaunchRunner.java:115)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
at
apple
.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:
52)
It may be that my initial setup is missing something that is expected.
However, since this occurs in the Launcher main method, it should be
fairly easy to detect the null case and use some appropriate default.
I wasn’t either before today. Amazing what a little luck on Google
will turn up.
Yep, that problem went away.
OT:
I do AI research. I haven’t been to AAAI in a while, though. And
our current research results were not quite ready for a paper this
year, so I likely won’t be at this summer’s either.
Actually, for some fun gaming-related stuff, you might want to look
at another research group that I’m doing some work with (Hmmm, I really
need to update my web page…) over at the Institute for Creative
Technologies – great name, what? – on virtual humans http://ict.usc.edu/projects/virtual_humans and simulation
agents in general http://ict.usc.edu/
"The default for -target depends on the value of -source:
o If -source is not specified, the value of -target is 1.6
o If -source is 1.3, the value of -target is 1.1
o For all other values of -source, the value of -target is the
value of -source."
Thus, if Sun’s 1.6 compiler does what the docs say it does, ‘-source 5’
and ‘-source 5 -target 5’ should produce equivalent output. But they
don’t—I get class files with bytecode version 50.0 with the former,
but 49.0 with the latter.
Well, 4th time’s the charm. I guess three doesn’t work because these
are binary computers and the needed something divisible by 2.
Oh, there was one minor glitch which I had to fix, which is that the
startup class was not set properly in the Info.plist. The one that
was edited was the bundle name and not the JVM parameter.
The key that needs changing is
Root>Java>MainClass
When I set that to VASSAL.launch.Main things launched fine.
The other thing is that the preference for max memory size doesn’t (yet)
update the Info.plist file. The preference stays saved in the
preferences
file, but it didn’t have any effect on the launch parameters in the
application.
(I’m guessing you haven’t gotten to that yet, since getting this working
was more pressing.)
Anyway, I’m glad to see that a native Mac App is being produced. This
will be great!
If it didn’t change the real Info.plist file, then you should have a
stack trace in your errorLog saying where it looked for the file. It
would help me to know where it looked relative to where the Info.plist
actually is.
On Tue, January 29, 2008 10:36 pm, Joel Uckelman wrote:
Will have a look at this and the 2917 build tonight - I guess they should
be good, as the latter works for Thomas, but given that there seem to be
some slight differences between the Intel and PPC JVMs, it’s worth
checking.
By Mac standards, they ought to go in ~/Library/Application
Support/org.vassal.VASSAL/, but I appreciate that’s more platform-specific
code
The big question here is how are these items to be installed? Any kind of
graphical file-selector won’t let you navigate to inside the app bundle,
so anything that asks the users where to install the plugin or extension
won’t be able to put it inside the bundle. Even ‘download and unzip to
inside the bundle’ is going to be beyond a lot of people who aren’t
shell-savvy.
There’s not much platform-specific code in VASSAL right now—all I know
of is what I’ve put in GlobalPreferences for writing heap size information
and what’s in TemporaryFileManager.
There are a bunch of other platform-specific things we need to do to make
the app look right on a Mac, so I’m thinking of creating a class which
holds platform-specific settings like directories, UI stuff, etc.
Interestingly enough, this one doesn’t run on an Intel-based Mac.
Even weirder, when I tried to mount the disk image again, I got a
message that the disk image was damaged and contained no mountable
file system. When it was directly downloaded, it automounted (with
some console error messages) but with an application bundle that
wouldn’t launch.