Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Saturday, June 01, 2019

Using Java 12 in Eclipse

1. Install JDK 12

Link: https://www.oracle.com/technetwork/java/javase/downloads/jdk12-downloads-5295953.html

2. Install Eclipse 4.11

Link: https://download.eclipse.org/eclipse/downloads/drops4/R-4.11-201903070500

3. Install Eclipse Java 12 Support

Start Eclipse and go to Help > Install New Software. Add Update Site: https://download.eclipse.org/eclipse/updates/4.11-P-builds. Install Eclipse Java 12 support for 2019-03 development stream from the list of available software

4. Add Java 12 JRE to Eclipse

Go to Window > Preferences, navigate to Java > Installed JREs and add the Java 12 JRE (that you installed in Step 1). Tick the box to make it the default JRE

5. Upgrade Compiler Compliance Level

In your preferences, go to Java > Compiler and select "12" as the "Compiler compliance level". In addition, tick "Enable preview features".

That's it! Now you can try out Switch Expressions!

Saturday, September 29, 2012

Installing Scala IDE for Eclipse Juno

Just spent ages trying to get the Scala IDE plugin working in Eclipse Juno (4.2).

Here are the links that finally worked for me:

To install them go to Eclipse > Help > Install new software... and enter the URL in the Work with... textfield.

Saturday, March 24, 2012

Eclipse: Writing Better, Faster Java Documentation

JAutodoc:
I've started using JAutodoc, which is an Eclipse plugin for automatically adding Javadoc to your source code. It helps generate the initial Javadoc for methods which don't have them and can even complete existing Javadoc by adding missing parameters and return types. I have found this plugin very useful in writing documentation fast.

Let's say you have the following method which adds two ints:

public int add(int x, int y) {
    return x + y;
}
To invoke JAutodoc, all you have to do is hit Ctrl+Alt+J inside the method and the following Javadoc template will be automatically generated, which you can then complete.
/**
 * Adds the.
 *
 * @param x the x
 * @param y the y
 * @return the int
 */
public int add(int x, int y) {
    return x + y;
}
Later on, if you decide to change this method by adding another parameter to it, you can press Ctrl+Alt+J again and JAutoDoc will add the new parameter to the Javadoc but leave the rest of it unchanged.

Enabling Eclipse Javadoc warnings:
I've also found it useful to turn on Eclipse warnings for missing or malformed Javadoc comments. You can do this by going to Window > Preferences and then selecting Java > Compiler > Javadoc. Tick the box for processing Javadoc comments and select your desired severity levels. I've got mine set to Warnings for everything. You can get my Eclipse preferences from my git repository.

Sunday, August 14, 2011

Useful Eclipse Templates for Faster Coding

I wrote about my Eclipse code templates a few years ago and since then I've made a quite a few changes to them. I've added a few new templates to help with JUnit tests and xml parsing. I've also updated my existing file IO templates to use Java 7 features.

Templates are simply "magic words" or shortcuts to standard blocks of code or text. They are very handy because once you have them setup you don't have to waste time writing boilerplate code any more! An example of a pre-defined template in Eclipse is sysout which expands to System.out.println();. All you have to do is type sysout followed by Ctrl+Space to insert the statement into your Java source file.

To see what templates are defined in Eclipse:

  • Open your Preferences dialog by going to Windows > Preferences
  • On the navigation tree on the left, go to Java > Editor > Templates
  • You will see a list of pre-defined templates
  • You can add new ones by pressing the "New..." button
My templates are shown below. They can also be downloaded from my GitHub repository and then imported into Eclipse.

General Utility Templates:

Nameif
ContextJava statements
Descriptionif null
Pattern
if (${var} == null){
    ${cursor}
}
Nameif
ContextJava statements
Descriptionif not null
Pattern
if (${var} != null){
    ${cursor}
}
Namefor
ContextJava statements
Descriptioniterate over map
Pattern
${:import(java.util.Map.Entry)}
for(Entry<${key:argType(map,0)},${value:argType(map,1)}> entry :
                    ${map:var(java.util.Map)}.entrySet()) {
    ${key} key = entry.getKey();
    ${value} value = entry.getValue();
    ${cursor}
}
Namestrf
ContextJava
Descriptionformat string
Pattern
String.format("${word_selection}${}",${var}${cursor})
Namesysf
ContextJava statements
Descriptionprint formatted string to standard out
Pattern
System.out.printf("${word_selection}${}",${var}${cursor});
Namestatic_final
ContextJava type members
Descriptionstatic final field
Pattern
${visibility:link(
              public,
              protected,
              private)} static final ${type} ${NAME} = ${word_selection}${};

File IO Templates:
The following templates are useful for reading or writing files. They use Java 7 features such as try-with-resources to automatically close files. They also use methods from NIO2.0 to obtain a buffered reader and read the file.

Namereadfile
ContextJava statements
Descriptionread text from file
Pattern
${:import(java.nio.file.Files,
          java.nio.file.Paths,
          java.nio.charset.Charset,
          java.io.IOException,
          java.io.BufferedReader)}
try (BufferedReader in = Files.newBufferedReader(Paths.get(${fileName:var(String)}),
                                                 Charset.forName("UTF-8"))) {
    String line = null;
    while ((line = in.readLine()) != null) {
        ${cursor}
    }
} catch (IOException e) {
    // ${todo}: handle exception
}
Namereadfile
ContextJava statements
Descriptionread all lines from file as a list
Pattern
${:import(java.nio.file.Files,
          java.nio.file.Paths,
          java.nio.charset.Charset,
          java.util.List,
          java.util.ArrayList)}
Lis<String> lines = new ArrayList<>();
try{
	lines = Files.readAllLines(Paths.get(${fileName:var(String)}),
                                        Charset.forName("UTF-8"));
}catch (IOException e) {
    // ${todo}: handle exception
}
${cursor}
Namewritefile
ContextJava statements
Descriptionwrite text to file
Pattern
${:import(java.nio.file.Files,
          java.nio.file.Paths,
          java.nio.Charset,
          java.io.IOException,
          java.io.BufferedWriter)}
try (BufferedWriter out = Files.newBufferedWriter(Paths.get(${fileName:var(String)}),
                                                  Charset.forName("UTF-8"))) {
    out.write(${string:var(String)});
    out.newLine();
    ${cursor}
} catch (IOException e) {
    // ${todo}: handle exception
}

XML Templates:
The following templates are used to read xml files or strings and return a DOM.

Nameparsexml
ContextJava statements
Descriptionparse xml file as Document
Pattern
${:import(org.w3c.dom.Document,
          javax.xml.parsers.DocumentBuilderFactory,
          java.io.File,
          java.io.IOException,
          javax.xml.parsers.ParserConfigurationException,
          org.xml.sax.SAXException)}
Document doc = null;
try {
	doc = DocumentBuilderFactory.newInstance()
			.newDocumentBuilder()
			.parse(new File(${filename:var(String)}));
} catch (SAXException | IOException | ParserConfigurationException e) {
	// ${todo}: handle exception
}
${cursor}
Nameparsexml
ContextJava statements
Descriptionparse xml string as Document
Pattern
${:import(org.w3c.dom.Document,
          javax.xml.parsers.DocumentBuilderFactory,
          org.xml.sax.InputSource,
          java.io.StringReader,
          java.io.IOException,
          javax.xml.parsers.ParserConfigurationException,
          org.xml.sax.SAXException)}
Document doc = null;
try {
	doc = DocumentBuilderFactory.newInstance()
			.newDocumentBuilder()
			.parse(new InputSource(new StringReader(${str:var(String)})));
} catch (SAXException | IOException | ParserConfigurationException e) {
	// ${todo}: handle exception
}
${cursor}

Logging Templates:
The templates below are useful for creating a logger and logging messages. I use SLF4J, but they could easily be tweaked to use any other logging framework.

Namelogger
ContextJava type members
Descriptioncreate new logger
Pattern

${:import(org.slf4j.Logger,
          org.slf4j.LoggerFactory)}
private static final Logger LOGGER =
       LoggerFactory.getLogger(${enclosing_type}.class);
Namelogd
ContextJava statements
Descriptionlogger debug
Pattern
if(LOGGER.isDebugEnabled())
     LOGGER.debug(${word_selection}${});
${cursor}
Namelogi
ContextJava statements
Descriptionlogger info
Pattern
LOGGER.info(${word_selection}${});
${cursor}
Namelogerr
ContextJava statements
Descriptionlogger error
Pattern
LOGGER.error(${word_selection}${}, ${exception_variable_name});
Namelogthrow
ContextJava statements
Descriptionlog error and throw exception
Pattern
LOGGER.error(${word_selection}${}, ${exception_variable_name});
throw ${exception_variable_name};
${cursor}

JUnit Templates:
The templates below assist in writing JUnit tests.

Namebefore
ContextJava type members
Descriptionjunit before method
Pattern
${:import (org.junit.Before)}

@Before
public void setUp() {
    ${cursor}
}
Nameafter
ContextJava type members
Descriptionjunit after method
Pattern
${:import (org.junit.After)}

@After
public void tearDown() {
    ${cursor}
}
Namebeforeclass
ContextJava type members
Descriptionjunit beforeclass method
Pattern
${:import (org.junit.BeforeClass)}

@BeforeClass
public static void oneTimeSetUp() {
    // one-time initialization code
    ${cursor}
}
Nameafterclass
ContextJava type members
Descriptionjunit afterclass method
Pattern
${:import (org.junit.AfterClass)}

@AfterClass
public static void oneTimeTearDown() {
    // one-time cleanup code
    ${cursor}
}

Do YOU have any useful templates? If so, share them in the comments section!

Saturday, August 06, 2011

Eclipse: Default to "File Search" Tab in Search Dialog

I don't like the fact that Eclipse defaults to "Java Search" whenever you open the Search Dialog (Ctrl+H), because I almost ALWAYS need "File Search". I then need to press Ctrl+Page Up to switch to the "File Search" tab. The good news is that there is a way to make Eclipse default to "File Search" by changing your key bindings. This is how:
  • Go to Window > Preferences and navigate to General > Keys
  • Type Open Search Dialog in the filter text box to search for the command. You should see it bound to Ctrl+H. Click on the command and press Unbind Command
  • Now type File Search and click on the command. In the Binding text field enter Ctrl+H
  • Press Apply
Now, whenever you hit Ctrl+H, the Search Dialog will show the File Search tab by default!

Another thing...
You can clean up the Search Dialog by removing those tabs that you don't need. Do this by opening the Search Dialog (Ctrl+H) and then clicking on Customize.... Deselect the ones you don't need e.g. Task Search, JavaScript Search, Plug-in Search, Spring Pointcut Matches etc.

Saturday, July 30, 2011

Java 7: Safe Varargs Method Invocation

In previous versions of Java, when you invoke a varargs method with a non-reifiable varargs type, the compiler generates a warning on the calling statement. Consider the code:
//varargs method
public static <T> void print(T... a) {
  for (T t : a) {
      System.out.println(t);
  }
}

//calling method
public static void main(String[] args){

  print("Hello", "World"); //this is fine

  print(new Pair<Integer,String>(1,"One"), new Pair<Integer,String>(2,"Two"));
  //WARNING: Type safety : A generic array of Pair<Integer,String>
  //is created for a varargs parameter
}
This because the compiler tries to create an array of Pair<Integer,String>[] to hold the varargs, which is not permitted because Pair<Integer,String> is type erased at runtime to just Pair. (More information here.) To suppress this warning, you need to add @SuppressWarnings("unchecked") to each method which makes a call to the varargs method.

In JDK7, the warning has been moved from the call site to the varargs method declaration and you can annotate the varargs method with @SafeVarargs in order to suppress it. This reduces the total number of warnings reported and those that have to be suppressed.

@SafeVarargs
// WARNING SUPPRESSED: Type safety: Potential heap pollution via varargs parameter a
public static <T> void print(T... a) {
  for (T t : a) {
      System.out.println(t);
  }
}

public static void main(String[] args){
  print("Hello", "World");
  print(new Pair<Integer,String>(1,"One"), new Pair<Integer,String>(2,"Two"));
  //no warnings :)
}
You can see this annotation used in JDK7's Arrays.asList method:

@SafeVarargs
public static <T> List<T> asList(T... a) {
   return new ArrayList<>(a);
}
Eclipse support:
Quick fix gives you the option to Add @SafeVarargs to your method.

Further Reading:
Improved Compiler Warnings and Errors When Using Non-Reifiable Formal Parameters with Varargs Methods

Java 7: Multi-catch

You can now catch more than one exception in a single catch clause which removes redundant code.

Here is an example of a statement which throws multiple exceptions:

try {
    Class.forName("Object").newInstance();
} catch (ClassNotFoundException e) {
    e.printStackTrace();
} catch (InstantiationException e) {
    e.printStackTrace();
} catch (IllegalAccessException e) {
    e.printStackTrace();
}
In JDK7, you can collapse the catch blocks into a single one:
try {
    Class.forName("Object").newInstance();
} catch (ClassNotFoundException |
         InstantiationException |
         IllegalAccessException e) {
    e.printStackTrace();
}
Eclipse Support:
  • If you have multiple catch clauses, quick fix gives you the option to Combine catch blocks provided all the catch bodies are the same

  • Conversely, if you have a multi-catch clause, quick fix gives you the option to Use separate catch blocks so that you can handle each exception separately

  • Quick fix gives you the option to Move exception to separate catch block which allows you to take exceptions out of the multi-catch in case you want to handle them separately

  • Quick fix also gives you the option to Surround with try/multi-catch
Further Reading
Handling More Than One Type of Exception

Java 7: Diamond Operator

The diamond operator (<>) removes the need for explicit type arguments in constructor calls to generic classes, thereby reducing visual clutter. For example:
//previously:
Map<Integer, List<String>> map = new HashMap<Integer, List<String>>();

//in jdk7, use the diamond operator. Saves typing!
Map<Integer, List<String>> map2 = new HashMap<>();

List<?> list = new ArrayList<>();
The compiler infers the type on the right side. So if you have a list of ?, the compiler will infer a list of Object.

Eclipse support:

  • Eclipse Content Assist (Ctrl + Space), auto-completes using a diamond instead of explicit type arguments. So, in the example above, when you type new HashM[Ctrl+Space], Eclipse will insert new HashMap<>();.

  • You can also configure Eclipse to warn you if you use explicit type arguments, instead of a diamond. To do this, go to your Preferences and navigate to Java > Compiler > Errors/Warnings. In the Generic types section, select Warning against Redundant type arguments. Eclipse will then offer you a quick-fix to remove the type arguments, if you accidently put them in.
Further Reading:
Type Inference for Generic Instance Creation

Using Java 7 in Eclipse

1. Download Eclipse 3.7 Maintenance Build:
Eclipse 3.7 does not have support for Java 7, but the good news is that you can download a a 3.7 "maintenance build" (>= M20110729-1400) which does. I downloaded mine from here. The download was really slow, because it was coming from Canada and there were no other mirrors!

2. Add a Java 7 JRE:
Start Eclipse and go to Window > Preferences. Navigate to Java > Installed JREs and add your Java 7 JRE to the list, as the default JRE.

3. Upgrade Compiler Compliance Level:
Once again, in your preferences go to Java > Compiler and select 1.7 as the "Compiler compliance level".

4. Check Project JRE:
If you are working on an existing project, you need to make sure that the project is using JDK7 system library. Go into your project properties and into Java Build Path. Select the Libraries tab and check the version of your JRE System Library. If necessary, press Edit... to change it to JDK7.

5. Test it out:
Create a test class and use a Java 7 feature e.g. List<String> list = new ArrayList<>();. This should compile successfully. Eclipse should even be able to auto-complete the diamond.

The latest news on Eclipse Java 7 support can be found on the Eclipse wiki: http://wiki.eclipse.org/JDT/Eclipse_Java_7_Support_(BETA).

Saturday, July 23, 2011

Copying Eclipse Preferences

If you want to transfer your preferences from one Eclipse installation to another, you can try the following approaches:

Option 1: Export/Import
Export your current preferences to a file and then import them into your new installation.
Go to File > Export and then choose to export General > Preferences to the local filesystem. Then start your second version of Eclipse, go to File > Import and choose to import General > Preferences.

Option 2: Copy runtime setting directory
Copy ${ECLIPSE_WORKSPACE}/.metadata/.plugins/org.eclipse.core.runtime/.settings from the existing installation to the new one.

Tuesday, February 16, 2010

Eclipse Memory Utilisation

On my PC, Eclipse is currently hogging 518 MB of RAM! Want to find out why Eclipse is using up so much memory? This is how:
  • Find the process id of Eclipse. You can use the jps command to help.
  • Now dump out the java object heap using the jmap command. For example: jmap -dump:format=b,file=C:\temp\eclipse_heap.bin 3080
  • Open the heap file (C:\temp\eclipse_heap.bin) in Eclipse.
Eclipse will take a couple of minutes to load the object heap into its Memory Analyser. It will then provide lots of useful information such as:
  • A Leak Suspects Report: My main suspect was org.maven.ide.components.nexus_indexer occupying 24,201,456 (24.29%) bytes.
  • A Histogram which lists the number of instances per class. There were 583,760 char[] objects and 439,572 String objects on my heap.
  • Dominator Tree which lists the biggest objects and what they keep alive. Mine were:
    • org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader @ 0x3f46368 org.maven.ide.components.nexus_indexer (23.1 MB)
    • org.eclipse.jdt.internal.core.JavaModelManager @ 0x4710728 (15.2 MB)
    • org.eclipse.jdt.internal.core.search.indexing.IndexManager @ 0x475c3e8 (9.7 MB)
    • org.eclipse.jdt.internal.ui.text.spelling.SpellCheckEngine @ 0x3d617a8 (6.5 MB)
  • Top Consumers which lists the most expensive objects grouped by class and package.
As a result of my findings, I have now removed the Maven Plugin and have also disabled the Spell Checker. Memory is down to 356 MB and the biggest object is org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager (26.1 MB).

Further Reading:
Eclipse Memory Analyzer, 10 useful tips/articles

Wednesday, October 14, 2009

Remote Debugging Java Applications

This is a quick post to show how you can connect to a remote Java virtual machine for debugging. I'm always forgetting the properties!

1. Add JVM Properties
Add the following properties to your java process before starting it up. This will tell it to accept debug connections.

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4001,suspend=y
2. Connect to Remote JVM through Eclipse
  • Go to your Eclipse Debug Configurations and create a new Remote Java Application configuration.
  • In Connection Type, choose Standard (Socket Attach).
  • Set the host to the machine where your Java application is running.
  • Set the port to the debug port specified in the JVM properties e.g. 4001.
  • Press Debug to start debugging.

Saturday, August 29, 2009

Speed up Eclipse

I've just noticed a big performance improvement in Eclipse 3.5 (Galileo), just by launching it with the latest JRE (1.6.0_16) and unlocking the new G1 garbage collector. My startup time has reduced from about 30 secs to 4-5 secs and the interface is snappier.

Here is my eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.0.200.v20090520.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.java.product
-data
c:\eclipse
-showlocation
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
384m
-vm
C:\program files\Java\jdk1.6.0_16\jre\bin\client\jvm.dll
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms128m
-Xmx384m
-Xss4m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+UseFastAccessorMethods
-XX:+AggressiveOpts
-Dcom.sun.management.jmxremote
Let me know if there are any other improvements I can make!

Saturday, November 22, 2008

Eclipse Code Templates

This post is out-of-date! For the latest version, go here: "Useful Eclipse Templates for Faster Coding".

In this post, I will share some of my Eclipse Java Code Templates.

Templates are simply "magic words" or shortcuts to standard blocks of code or text. They are very handy because once you have them setup you don't have to waste time writing boilerplate code any more! An example of a pre-defined template in Eclipse is sysout which expands to System.out.println();. All you have to do is type sysout followed by Ctrl+Space to insert the statement in your java source file.

To see what templates are defined in Eclipse:

  • Open your Preferences dialog by going to Windows > Preferences
  • On the navigation tree on the left, go to Java > Editor > Templates
  • You will see a list of pre-defined templates
  • You can add new ones by pressing the "New..." button
Here is a list of templates I have created:

1. logger

Name: logger
Context: Java statements
Description: create new Logger
Pattern:

${:import(org.apache.log4j.Logger)}
private static final Logger logger =
       Logger.getLogger(${enclosing_type}.class);
2. logd

Name: logd
Context: Java statements
Description: logger debug
Pattern:

if(logger.isDebugEnabled())
     logger.debug(${word_selection}${});${cursor}
3. logi

Name: logi
Context: Java statements
Description: logger info
Pattern:

logger.info(${word_selection}${});${cursor}
4. logerr

Name: logerr
Context: Java statements
Description: logger error
Pattern:

logger.error(${errorMessage}, ${e});
5. readfile

Name: readfile
Context: Java
Description: read text from file
Pattern:

${:import(java.io.BufferedReader,
          java.io.FileNotFoundException,
          java.io.FileReader,
          java.io.IOException)}
BufferedReader in = null;
try {
   in = new BufferedReader(new FileReader(${fileName}));
   String line;
   while ((line = in.readLine()) != null) {
      ${process}
   }
}
catch (FileNotFoundException e) {
   logger.error(e) ;
}
catch (IOException e) {
   logger.error(e) ;
} finally {
   if(in != null) in.close();
}
${cursor}
6. for (iterate over map)

Name: for
Context: Java statements
Description: iterate over map
Pattern:

for(Map.Entry<${key:argType(map,0)},${value:argType(map,1)}> entry :
                    ${map:var(java.util.Map)}.entrySet()) {
    ${key} key = entry.getKey();
    ${value} value = entry.getValue();
    ${cursor}
}
Do YOU have any useful templates? If so, share them in the comments!

Saturday, August 23, 2008

Eclipse Shirt Is Here!

FedEx dropped off the much anticipated Eclipse t-shirt today and I must say, it looks fab! I got it as a result of taking part in the Ganymede Around the World Contest. My coder friends are going to be so jealous!

I've posted a few pictures of the t-shirt here. Enjoy!


Front
Back
Eclipse Logo
Eclipse
Sleeve

Related post:
Here is my review of Ganymede, for those who missed it: Eclipse Ganymede Review

Friday, August 01, 2008

Eclipse Shirt Is Coming!

I finally received the following email from Lynn Gayowski, of the Eclipse Foundation, about the shirt they promised for taking part in the Ganymede Around the World Contest:
Thank you for submitting a review of the Eclipse release to the Ganymede Around the World contest. We have an Eclipse shirt for you! Please send me your:
1) Name
2) Shirt size (men’s small, medium, large, X-large, 2X-large or women’s small, medium, large)
3) Mailing Address
4) Phone Number (Fedex requires this for deliveries)

The contest closed yesterday, so all blog entries have been passed on to a panel of judges and we hope to have the winners of the Eclipse jackets and conference pass announced in a few weeks.

Thank you for participating and best of luck in the contest.

Regards,
Lynn Gayowski
Marketing Events Manager
Eclipse Foundation, Inc.
P (613) 224-9461 ext. 234
F (613) 224-5172
lynn.gayowski@eclipse.org
www.eclipse.org

I have sent them my details and am looking forward to getting my shirt. I will be posting pictures here as soon as it arrives, so come back soon! Better still, subscribe to my feed!

Related post:
Here is my review of Ganymede, for those who missed it: Eclipse Ganymede Review

Thursday, July 10, 2008

Eclipse Ganymede

Eclipse Ganymede is the annual release of Eclipse projects; this year including 23 projects. Some highlights of the release include the new p2 provisioning platform, new Equinox security features, new Ecore modeling tools, support for SOA and much more.

I have been using the new Eclipse Ganymede release for about two weeks now and think its time to write a review and share some of my experiences with the rest of the developer community. On the whole, I think the new release is as snappy as previous versions and brings some welcome improvements. Here are some of the features that I really like in this release:

Breadcrumbs:
The editor now displays a breadcrumb navigation bar showing the path to the current file. You can easily access the project and package structure as well as the individual classes, fields and methods from the bar itself. I really like this feature because I no longer have to keep my Package Explorer and Outline views open, thus saving on precious screen estate.

Enhanced Hover:
In the previous version, you had to use the awkward keyboard shortcut of Ctrl+1 on top of an Error or Warning to get the Quick Fix options. In Ganymede, all you have to do is hover over the problem and it pops up a window with links to the options. Great!

Highlight Read/Write Variables:
A small but useful addition to this release is that Mark Occurrences (Alt+Shift+O) now marks read and write accesses with different colours. Previously, Eclipse offered the ability to highlight all occurrences of a variable but now it distinguishes between read and writes for you.

Call Hierarchy for Fields and Types:
This allows you to find all the members which access the field (for read or write) and the constructors of a type. Previously, you could only find callers of a method.

Support for External Class Folders
Class folders located outside the workspace (external) can now be added to the build path. Previously, I had to build a jar file and then add it using "Add External JARs" so this is a welcome improvement! You can even add other kinds of zip archives to the build path e.g. RAR files.

Performance:
To be honest, I haven't noticed any increase or decrease in either the start-up time or interaction with the user interface. However, there has reportedly been a lot of internal improvement to the JDT compiler so that compilation can now be spread across multiple cores rather than being able to utilise only one. This should speed up build times.

There are still many more things for me to try out. In particular I would really like to try out the Test and Performance Tools Platform Project.

Got your own experiences with Ganymede? Share them in the comments.

For more details:
What's New in 3.4 (JDT)
Learn more about Ganymede

Friday, May 30, 2008

Increase Console Output in Eclipse [Howto]

By default, Eclipse limits the amount of text in the console output window. So if you are running a program which produces a lot of output, the Console will only display the last n lines and you lose the rest.

Here is a tip which will allow you to have unlimited output in the console:
  • Go to Window > Preferences > Run/Debug > Console
  • Uncheck "Limit Console Output" (Alternatively you can increase the Console buffer size.)