java - How To Run SWT application on both xp and windows 7 -


i made application swt , export jar , run it. machine (win xp).

and java version : java version "1.6.0_39" java(tm) se runtime environment (build 1.6.0_39-b04) java hotspot(tm) client vm (build 20.14-b01, mixed mode, sharing)

then try run jar on machine windows 7 : java version "1.7.0_17" java(tm) se runtime environment (build 1.7.0_17-b02) java hotspot(tm) 64-bit server vm (build 23.7-b01, mixed mode)

but machine couldn't launch application. tried run jar on cmd using: java -jar myapp.jar got exception:`

exception in thread "main" java.lang.reflect.invocationtargetexception     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source)     @ java.lang.reflect.method.invoke(unknown source)     @ org.eclipse.jdt.internal.jarinjarloader.jarrsrcloader.main(jarrsrcloader.java:58)caused by: java.lang.unsatisfiedlinkerror: cannot load 32-bit swt libraries on 64-bit jvm     @ org.eclipse.swt.internal.library.loadlibrary(unknown source)     @ org.eclipse.swt.internal.library.loadlibrary(unknown source)     @ org.eclipse.swt.internal.c.<clinit>(unknown source)     @ org.eclipse.swt.widgets.display.<clinit>(unknown source)     @ projectpackage.g.init(g.java:258)     @ projectpackage.g.main(g.java:225)     ... 5 more` 

and eclipse using jre6

so how generate jar work in both machines ?

thanks in advance time

well, exception quite self explanatory:

unsatisfiedlinkerror: cannot load 32-bit swt libraries on 64-bit jvm

to jar working on both 32bit , 64bit should have @ answer:

create cross platform java swt application

you have include swt.jar platforms plan deploy app , given code determine during runtime version of .jar use.


a quick , dirty fix open jar file , exchange contained swt.jar (32bit) other version (64bit). however, restrict app 64bit.


conclusion:

  • either create separate jars different oss , bit versions (each containing 1 swt.jar)
  • or create 1 jar rule them (containing swt.jars)

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -