Tuesday, May 6, 2014

java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM


This problem occurs when we are trying to load 32 bit swt libraries (ex: swt.jar) on 64 bit Java

Example: When you are trying to open your 32 bit eclipse with 64 bit JRE, you will be facing this issue.

Another case would be, you would have packaged 32 bit swt libraries with your application, but you are trying to run your application on 64 bit JRE.

How to resolve ?
Make sure you will be using the same version either 32 bit/64 bit for eclipse and Java.


Error:
java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:197)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:174)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:687)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:145)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:88)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
at org.eclipse.equinox.launcher.Main.main(Main.java:1384)

Finding a .log file in eclipse

Your .log file is located in a .metadata folder in your current workspace directory.
The following is the path if you are working on the default workspace.

Example:

Windows : C:\Users\username\Documents\<Studio Workspace>\.metadata\.log

Mac OS X: ~/Documents/<Studio Workspace>/.metadata/.log


Wednesday, April 30, 2014

Wednesday, April 16, 2014

Writing git log output to a file

Example:
$ git log --since="04/07/2014 20:37:53" --no-merges  > C:\test.log

It will write generated git log from the specified date and time without including merges to a test.log file.

Monday, April 7, 2014

Creating an executable JAR file for SWT Plug-in - Runnable JAR

You would have developed a small utility application, and now you wanted to create an executable JAR for that application.
Basically, end user should be able to launch the application by just double clicking on that.

Eclipse provides an option called “Runnable JAR” in the export menu items to perform this.






This will generate Plugin_Refactor_x86_1.0.jar file, including with all the required swt jars. 

Since swt native jars will be platform specific, we need to generate 32 bit or 64 bit files separately.

How to check Installed Java is a 32 bit or 64 bit version ?


If you have installed JDK, Java would have registered in the system environment variables.

Go to command prompt and type “java –version”

C:\Users\kh1205>java -version
 java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

If it’s a 64 bit Java, you will be finding “64-Bit Server VM” in the above line.

If it’s a 32 bit java, you will be finding “Client VM” in the above line.

I have another JDK configured in my system, for which I wanted to check java version.
For example, other version of java is available in the location “C:\Program Files (x86)\Java\jdk1.6.0_31

C:\Program Files (x86)\Java\jdk1.6.0_31\bin>java -version
 java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)


“Client VM” in the last line tell you that,  JDK is a 32 bit version.

Friday, March 28, 2014

Microsoft visio for UML

Microsoft visio supports UML diagrams.

  • Class diagram
  • Sequence diagram
  • Use Case diagram
  • Activity diagram
  • State diagram

Download trial version @ http://office.microsoft.com/en-in/visio/

You can download UML2.5 stencils @ http://www.softwarestencils.com/uml/index.html