SWT on 32 bit and 64 bit JRE - swt

Can anyone suggest good idea over this issue.!!
Am aware of 32 bit JRE can load only 32 bit SWT libraries and also 64 bit JRE can load only 64 bit SWT libraries.
But my question is, how to load SWT libraries ( 32 bit and 64 bit ) dynamically based JRE bit size.?
Thanks in advance.!!

under the JRE installation path you will find lib\ext this is for any additional libraries you wish to add the the JRE. They will be picked up by any java application that wishes to use them.
the other option is to put them in the required classpath
java -cp:other_libraries my.Program
you could but that in a shell script eg
run64.cmd
java -cp<SWT64_libraries>:other_libraries my.Program
run32.cmd
java -cp<SWT32_libraries>:other_libraries my.Program
there are ways to autodetect the bitness of the JRE but they are not trivial.

Related

javah.exe not included in Windows JDK 8?

I'm trying to learn JNI on Windows 7 64-bit, but JDK 8 does not include javah.exe. I tried both the 32-bit and 64-bit versions. The Oracle documentation shows that javah is part of JDK 8 and doesn't make any platform distinction. Is there a separate download for JNI?
Also, the tutorials that I could find on JNI on Windows are pretty old - is there a newer way to do JNI in Windows, or does anyone have any suggestions for current Windows JNI Tutorials? NetBeans is my preferred IDE, but I'm not exclusive.
Hej Kevin, there is no seperate download needed for JNI and javah.exe is included in your JDK, search for it in %JAVA_HOME%/bin (if you don't have set this environment variable, look into C:\Program Files\Java\jdk1.8.0_121\bin or the version you have). Make sure you have downloaded the JDK, not JRE. And, the best JNI tutorial to start with is indeed that one, at least for me it was.

Eclipse JVM version issue: System.getProperty("sun.arch.data.model") returns 32 bit but i want 64

If i run "java -version" it returns 64 bit, which i guess means that my default JVM is 64 bit? but eclipse is using 32 bit since System.getProperty("sun.arch.data.model") returns "32".
I can't use the libraries i need in 32bit mode, jogl which auto detects my platform and incorrectly tries to load a 32bit dll. See more information in my other question: https://stackoverflow.com/questions/14007335/eclipsejogl-issue-cant-load-amd-64-bit-dll-on-a-ia-32-bit-platform
I'm running 64 bit windows 7, eclipse, java and JDK. even tried uninstalling Jre 32 bit to no avail.
Someone else having a similar problem with no solution given: How to reconfigure eclipse to use a 64 bit JVM
Can anyone tell me how i can specify the correct jvm?
That "trick" is just the normal configuration file for eclipse and it's used to specify the full path for the VM that the user wants to adopt.
The standard JVM also offers the -d64 that tries to force the adoption of the 64 bit memory model.
If you want to keep your environment compatible as much as you can with the libs out there you should keep the 32 bit version, and I'm saying this because of my experience with java, also the 32 bit version is probably more stable than the 64 bit version, especially when interacting with external libs ( again in my experience ).
Anyway keep in mind that you need the 64 bit version of Eclipse, otherwise you will go nowhere.
You should install a 64 bit version of Eclipse. Or what you can do is edit the Eclipse.ini file, and change the path it uses for java.exe or javaw.exe to start eclipse to point to your 64 bit version. Also make Eclipse.ini is picking up the right JAVA_HOME environment variable, which may be whatever that value is set to in Windows.
Eclipse has environment variables it uses, but it picks most of them up from Windows. If you change the ones in Windows, you need to restart Eclipse to pick up the new values. I think Java changes the JAVA_HOME variable anytime you install a new version.
Maybe you can tell eclipse where is you own JDK.
Eidt the eclipse.ini in eclipse home dir:
-vm
/path/to/jdk64/bin/javaw.exe
If you want to compile a project in eclipse with jdk 7, click here.

What are the prerequisites for Eclipse 64 bit?

What are the prerequisites for Eclipse 64 bit?
Do I have to download eclipse 64 bit for jdk 1.6 64 bit or 32 bit jdk will suffice to work with 64 bit DLLs? I have configured 32 bit Eclipse to have 64 bit JDK. But when I run my test suite then I'm getting java.lang.OutOfMemory error
When I installed Eclipse 64-bit, I had to install 64-bit JDK. I'm not 100% sure if it is an absolute requirement, but it seems to be the best way.
Plus the 32-bit and 64-bit versions of Java can coexist on the machine.
I wouldn't mix the 64-bit eclipse with a 32-bit JDK or vice versa. Stick with 64-bit or 32-bit for both. Of course as Almo says, you can have both installed and tell eclipse to use the correct jvm using the eclipse.ini file.

Java and Eclipse - 32 vs. 64bit

I'm a little bit confused about the two different versions of Eclipse - 32/64bit.
As far as I know, Java bytecode (= build of your code) is platform independend. If a user runs your bytecode in a 32bit JRE, the code is executed in as a 32bit process, if a user runs your bytecode in a 64bit JRE, the code is exectued as a 64bit process.
Eclipse needs the JRE to run, cause it's written in Java. But why are there 32 and 64bit versions of Eclipse on the Eclipse download page if only the user's JRE version does matter?
Does a 64bit Eclipse version need a 64bit JRE or JDK? If yes ,why?
Second confusion: I understand the need for a 32 and 64 bit version of the JRE. But why are there 32 and 64 bit versions of the JDK if the resulting bytecode is platform independet?
Thank you
Eclipse relies on SWT, which is essentially native code. There will be quite a few DLLs etc. exists (in the plugins or features directories) that will be used by the 64-bit version, that are drastically different from the 32-bit version.
It is not because of the running environment, it is because Eclipse uses some native stuff and must be run on corresponding JDK. The applications you are developing inside Eclipse can then be run on whatever JRE you have installed, just specify it in the settings.
JDK is a compiler and also a lot of other stuff. Many of them are native applications that need to be run corresponding platform.

Can i make Jboss Tools plugin to run on JDK 32 while run Eclipse on JDK 64?

Can i make Jboss Tools plugin to run on JDK 32 while run Eclipse on JDK 64?
I wanted to do this because i need to assign more memory to eclipse while making Jboss tools (visual editor) use the 32 jdk hence it doesn't on 64.
noting i am running a Windows 7 64, if yes how can i achieve this?
Can i make Jboss Tools plugin to run on JDK 32 while run Eclipse on JDK 64?
Assuming you are talking about a plugin for Eclipse, the answer is - No.
A plugin for Eclipse runs in the same JVM as Eclipse itself. That has to be either 32 bit or 64 bit. It can't be both!
Why do you need to "making Jboss tools use the 32 jdk"? Do you mean that you want it to launch a 32bit JVM to run JBoss? If so, then you should be able to do this either via preferences in the JBoss plugin or via the relevant application launcher configuration. (Maybe someone with experience with this particular plugin could chime in with specific details.)
But lets be clear, this is NOT making the "Jboss Tools plugin to run on JDK 32" ...