Thursday, September 11, 2014

eclipse -clean option in mac os x


1. Go to eclipse directory
2. Find Eclipse Application
3. Right click on  Eclipse Application
4. It will show "Show Package Contents" menu option
4. Click on Show Package Contents
5. Go to Contents folder
6. Go to MacOS folder
7. Open the terminal
8. Drag the MacOS directory to terminal for change directory(ex: cd <macos directory>)
8. execute this " ./eclipse -clean"

eclipse.ini file in Mac os x

1. Go to eclipse directory
2. Find Eclipse Application
3. Right click on  Eclipse Application
4. It will show "Show Package Contents" menu option
4. Click on Show Package Contents
5. Go to Contents
6. Go to MacOS
7. Look for eclipse.ini file


Monday, September 8, 2014

Unsupported major.minor version 51.0

java.lang.UnsupportedClassVersionError happens because of a higher JDK during compile time and lower JDK during runtime.

51.0 in "Unsupported major.minor version 51.0" represents that, .class file generated with JDK 1.7 and but you are trying with run with(runtime) with lower version of it.

Below are the version numbers and compatible JDK's.

J2SE 8 = 52,
J2SE 7 = 51,
J2SE 6.0 = 50,
J2SE 5.0 = 49,
JDK 1.4 = 48,
JDK 1.3 = 47,
JDK 1.2 = 46,
JDK 1.1 = 45


To resolve this issue, make use of same version during the compile time and run-time.

Example: You would have generatd jar file with jdk 1.7 and but you are trying to run that jar using JDK 1.6 eclipse, this leads to above error.



Saturday, August 23, 2014

What is eclipse workbench ?

A workbench is the root object for the Eclipse Platform user interface.

A workbench has one or more main windows which present to the end user information based on some underlying model, typically on resources in an underlying workspace. A workbench usually starts with a single open window, and automatically closes when its last window closes.

Each workbench window has a collection of pages; the active page is the one that is being presented to the end user; at most one page is active in a window at a time.

Each workbench page has a collection of workbench parts, of which there are two kinds: views and editors. A page's parts are arranged (tiled or stacked) for presentation on the screen. The arrangement is not fixed; the user can arrange the parts as they see fit. A perspective is a template for a page, capturing a collection of parts and their arrangement.

The platform creates a workbench when the workbench plug-in is activated; since this happens at most once during the life of the running platform, there is only one workbench instance. Due to its singular nature, it is commonly referred to as the workbench.

Friday, August 22, 2014

How to get eclipse workspace project path ?


public String getProjectPath(IProject project) {
   String absolutePath = project.getLocation().toFile().getAbsolutePath();
    return absolutePath ;
}

Converting Java io File to eclipse IFile resource


Below function will convert java.io File to eclipse IFile resource.

public IFile convert(File file) {
   IWorkspace workspace= ResourcesPlugin.getWorkspace();  
   IPath location= Path.fromOSString(file.getAbsolutePath());
   IFile ifile= workspace.getRoot().getFileForLocation(location);
 return ifile;

}

This works only when resource exists with in the workspace.

Accessing the resources outside the workspace:
http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace%3F