How to ensure that a jnlp is run on a 64bits jvm
Asked Answered
U

3

7

I have a JNLP applet that is run on a 64bit computer with both 32 and 64 bits JVM installed. The JNLP must run on the 64bit JVM in order to execute correctly. Is there a way to force the use of a 64bit JVM?

Unripe answered 14/12, 2011 at 15:3 Comment(4)
"The JNLP must run on the 64bit JVM in order to execute correctly." Why?Aleras
@Andrew, memory! it's a hard one. Also perhaps native libs, etc.Clitoris
@Clitoris Thanks, but I wasn't asking for speculation from passers-by. I want a specific answer from the OP.Aleras
@Andrew, so ask a new question about. seriously though, it doesn't matter why, JNI/JNA/memory limits are quite different on 64bit, so is the maximum virtual memory for files mapped, etc.Clitoris
S
1

Use -d64 the VM option to only allow the virtual machine to start at 64bits. Other way it's simple not start. Not to friendly but make the job. In console mode print:

Error: This Java instance does not support a 32-bit JVM.
Please install the desired version.

-d64 is supported since 1.5.0

Sepoy answered 29/6, 2012 at 4:2 Comment(2)
NO. Use "-d64" (-D64 is an error in the Oracle documentation, -D in uppercase is used to define an environment variable) to pass it as a JVM option, pass it as "-J-d64"Sportive
-d64 and -D64 has different meaning, because is case sensitive.Lacedaemonian
D
0

See here: How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)?

You can use this to detect a 64-bit JVM, and if it's not, you show an error message.

Dextrorotation answered 14/12, 2011 at 15:13 Comment(1)
The only one of those techniques that comes close to working in a JNLP file is the os.arch test. OP would need a list of all 64-bit os.arch values. (There's at least "xmd64" and "amd64" for two common architectures.)Brawl
M
0

If you use a 64Bit Browser then the 64Bit JVM is used. If you use a 32Bit Browser (which is default for most browsers nowadays) the 32Bit JVM is used. So e.g. firefox and chrome only have 32Bit versions out there (of course there are test/develop versions out there but nothing official). Microsofts IE is one of the few offering both versions.

You can not ensure that the jnlp will run in 64 Bit environment. However you can ensure in your applet code, that is was started in the right environment:

String architecture = System.getProperty("os.arch");

if(architecture.equals("i386") || architecture.equals("i686")){
 architecture = "x86";
}
else if(architecture.equals("amd64") || architecture.equals("universal")){
 architecture = "x86_64";
}
Manifold answered 18/2, 2014 at 22:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.