Re: JLink

*To*: mathgroup at smc.vnet.net*Subject*: [mg82103] Re: JLink*From*: John Jowett <John.M.Jowett at gmail.com>*Date*: Fri, 12 Oct 2007 02:55:03 -0400 (EDT)*References*: <200708230457.AAA08711@smc.vnet.net><far9so$4ci$1@smc.vnet.net>

Hello, I have the same problem as I want to use Java classes (developed by others) that need a newer Java than the one installed with Mathematica 6. I can do this with ReinstallJava[CommandLine->"C:\\Program Files\\Java\\jre1.6.0_02\\bin\ \\java"] which returns LinkObject[C:\Program Files\Java\jre1.6.0_02\bin\java -classpath \ "C:\Program Files\Wolfram \ Research\Mathematica\6.0\SystemFiles\Links\JLink\JLink.jar" -Xmx256m \ com.wolfram.jlink.Install -init "C:\Documents and \ Settings\jowett\Local Settings\Temp\000003a05884",10,4] This works but there is a troublesome side-effect that a (Windows XP) Command Prompt window appears containing the text J/Link (tm) Copyright (C) 1999-2007, Wolfram Research, Inc. All Rights Reserved. www.wolfram.com Version 4.0.2 This window appears useless and clutters the screen so I can scarcely resist the urge to close it. However this aborts the Java process. I suspect there must be an additional option to the Java command line that will stop it from appearing but I can't find it. Does anyone know the solution ? (Of course it would be nicer if there was an option to make Mathematica start up running the more recent Java and avoid interrupting anything that might already be using Java.) Thanks, John Jowett On Aug 26, 9:25 am, Todd Gayley <tgay... at wolfram.com> wrote: > At 11:57 PM 8/22/2007, dh wrote: > > > > > > >Hello, > > >Mathematica 6 comes with an outdated Java. Therefore, it may be > > >necessary to use a newer version. A clumsy solution is to change the > > >Java in the installation. However, there was a better method that worked > > >before v6: > > >InstallJava takes an option "CommandLine" that specifies a command line > > >to start Java. In version 6 this does no more work correctly. If I say: > > >InstallJava[CommandLine->"name of new java"] > > >the old Java of mathematica is loaded, despite the option. However, if I > > >prevent mathematica to find the java executable by renaming the > > >corresponding folder, the correct java is now loaded. > > >Daniel > > Daniel, > > Java is now launched at startup time, so when you call > InstallJava[CommandLine->"..."] J/Link just returns the current Java > link. What you need to do is force Java to restart with your desired options: > > ReinstallJava[CommandLine->"..."] > > Incidentally, the pre-launch of Java has been anticipated for a long > time, so the J/Link User Guide has been warning about it for several > years: "Programmers should not assume that they have the ability to > control the launch of the Java runtime, as it might already be > running. If for some reason you absolutely must apply options to > control the launch of the Java runtime, useReinstallJavainstead of > InstallJava." > > --Todd- Hide quoted text - > > - Show quoted text -