Hi,
This stupid question shows my Java ignorance but I can’t seem to figure out how to have Servoy start up using Java 1.5 (on Mac OS X.4). I have set it in the Java Preferences.app that is installed when you install 1.5 and I have also set it within Servoy (I thought) by showing the package contents of Servoy and changing it in the info.plist from ‘1.4+’ to ‘1.5+’. However when I start Servoy with ‘Stacktrace’ the output I get is:
Servoy R2 2.2 build-328 on Mac OS X using Java 1.4.2_07
It seems from postings that it is easy to do but not for me! Can’t seem to find anything about how to do it either. ![Crying or Very sad :cry:]()
Any help would be appreciated!
Hi John,
Open the Java Preferences app. (/Applications/utilities/Java/J2SE 5.0/Java Preferences.app)
You have to change 2 settings there.
- set ‘Use version’ to J2SE 5.0
- Change the order in ‘Java Application Runtime Settings’ so that J2SE 5.0 is at the top.
Hit the save button and now you can launch any java app using the 1.5 JVM.
Hope this helps.
Hi Robert,
Unfortunately that is exactly what I had done and I thought that would do it too. But when I launch Servoy from Terminal with Stacktrace I get that output I mentioned earlier which I presume means Servoy is actually using 1.4. There are notes around the apple web pages that imply the individual Java application can then choose whether to use 1.4 or 1.5 which seems logical. So I thought I would have to do it on the Servoy info.plist (where you can also change the memory Servoy allocates). But that doesn’t seem to do it either. Is there some other preference or something I’m missing?
John
By the way has anyone else run ‘Stacktrace’ when changing to Java 1.5 on a Mac? Is it possible that the output itself is wrong and Servoy is actually running under 1.5? Or maybe I can’t just change ‘1.4+’ to ‘1.5+’ in the Servoy info.plist and it needs some other description or some other change?
It seems that double clicking the .jar file will open it with the JVM set in the Java Preference. But when launched via the commandline it uses the 1.4.x JVM.
With that being the case, is there a way to change the Java version from the command line that you know? I presume it is some parameter given to the ‘java’ command but in looking up the ‘man’ pages on java I couldn’t figure it out.
I prefer to use the command line for launching Servoy. For one thing it is much faster for some reason: 30 seconds via command line vs 1 minute 33 seconds via the application from start until the dialog for choosing the solution. Plus it lets me have an overview of what is happening when I’m developing which I like. The speed difference doesn’t seem to have much to do with the fact the application is running 1.5 and the command line 1.4 by the way. Switching back and forth between the two with the application, Java 1.5 seems to improve the speed just a little and certainly doesn’t make it slower.
Well there is the option to use:
-version:<required version>
But I am not sure what version string you should use.
Any java coder here knows?
Interesting that you get
-version:
. My man pages just say
-version
Displays version information and exit.
And that is what mine does. When I enter ‘java -version’ it just exits showing
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-215)
Java HotSpot(TM) Client VM (build 1.4.2-50, mixed mode)
That too is interesting since again I have selected 1.5 to be the default java installation, or so I thought, with the java preferences app.
But it appears that one needs to set it somehow in Terminal. I thought it would be with the ‘classpath’ parameter. Any help here with the Java guys? Also why is loading Servoy developer SO much faster using the terminal than clicking on the application?
John
Just type in the command:
java
And there it is:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-jvm is a synonym for the "client" VM [deprecated]
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
Thanks Robert. I’ve always gone to the ‘man’ pages and that version of ‘version:’
doesn’t show up. I think you are right that that is how to do it but I couldn’t get the syntax right either. Says :
Unable to locate JRE meeting specification “1.5”
Tried different syntax but couldn’t do it. Maybe it is also a path thing and it’s not looking in the right area. Somehow I put this whole thread by mistake in SQL Databases. I’ll try posting in the ‘installation’ section too.
Hi Robert,
I posted this on the Java 1.5 link too but in case you are interested and didn’t see that I have a workaround for launching Servoy developer from the command line using Java 1.5 with Tiger. From your Servoy directory:```
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/home/bin/java -DSTACKTRACE=true -jar servoy_developer.jar
Hi John,
Thanks!
john.allen:
I think there should be a way to simply have that as part of the path and then call whatever version you want but I can’t get the syntax right. But this does work and it cuts the launch time down another 5 seconds from 30 to 25! 
Nothing a little shell script can’t fix 
Like the following code:
#!/bin/sh
cd /Applications/Servoy/
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/home/bin/java -DSTACKTRACE=true -jar servoy_developer.jar
Save this as a .sh file anywhere on your system.
Then make it executable:
chmod 755 <your shell script>
And now you can double click it from the finder 
Hmm..not even needed to use chmod.
Just rename the file to .command in the finder and voila ![Smile :)]()
UPDATE:
I was too hasty.
You do need to set the executable bit.
So chmod is needed.
Very nice! I had done the chmod part anyway and it works like a charm! Sweet! I like to work in stacktrace mode not least because start up is so much faster. Still curious as to why that is. Might have to wait until Servoy World! Thanks again Robert
It launches faster with and without STACKTRACE.
Right now I have 4 shell scripts. One without STACKTRACE and one with.
Of course for 1.4 and 1.5 ![Smile :)]()
Thank you for the terminal-launch speed-tip ![Very Happy :D]()
Are you saying that it lauchnes quicker with -DSTACKTRACE=TRUE then without??
That is very strange. -DSTACKTRACE=TRUE is making everything quite a lot slower (because of the many log lines that are generated)
I think he is saying that using the command-line to launch Servoy is faster than double-clicking it in the finder.
And it’s significantly faster ![Exclamation :!:]()
that has to be a mac thingy…
I did some testing and the attached plist appears to make Servoy launch on mac about 3.141592654 times faster. Put it inside the servoy.app package in the Contents folder.
Info.plist.zip (708 Bytes)
Wonderful !!
/me hands Jan a piece of Pi(e) ![Wink ;)]()