0

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.!!

sanjay
  • 45
  • 1
  • 8
  • Put the appropriate SET lib in the ext path of the JRE would be the easiest. Otherwise you want to write a shell script to construct the appropriate path based on bit size. – BevynQ Jun 12 '13 at 04:36
  • Thanks BevynQ..Am not too technical person..could please explain briefly..please.!! – sanjay Jun 12 '13 at 04:46
  • If you are running Java in a 32bit machine, you will be using a 32bit java. Otherwise, not even the java command will work. If the library is installed in such a machine it should be installed in the 32bit java path (lib/ext). If you provide the library yourself (I do not know if that is possible given the license of the library), you should provide both versions, and two versions of executables (or batch files or launching scripts) that will launch the application adding to the classpath the path to your library jar file explicitly. – Angelos Asonitis Apr 27 '19 at 16:12

1 Answers1

1

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.

BevynQ
  • 8,089
  • 4
  • 25
  • 37
  • Currently am working with Eclipse IDE and JRE 64 bit.It is not loading correct SWT while running. am getting Class not found error. – sanjay Jun 12 '13 at 05:15
  • have a look at http://stackoverflow.com/questions/2921193/swt-on-windows-64-bit particulary mario's answer. – BevynQ Jun 12 '13 at 05:22
  • The problem is am generating Exe and installing in another machine. At that point of time i need to redirect correct SWT- lib's based on JRE bit size..pls share some idea.? – sanjay Jun 19 '13 at 09:42
  • build two exes one 32 and one 64. let the user figure it out. – BevynQ Jun 20 '13 at 02:43