Longstanding Eclipse issues - fix them finally, please

Eclipse is the best IDE ever. It's the most stable, most popular, most- a lot of things. The developers that write the Eclipse code have T-shirts that say that - they are that proud. The code-base is said to be awesome - I don't have time to check. But, there are some longstanding issues.

First, SVN client. There's a CVS client that comes with Eclipse. SVN is way more popular. Put the client inside finally. I'm sick of solving numerous JavaHL issues. Fix it. I don't care how, just do it.

Second, Tomcat is the best web container ever and most popular in development. Integrate it better. There are numerous issues with debugging, redeployment and so on. These problems are so old. Fix 'em NOW.

Third, installing plugins is soooo slow. So very slow.

Fourth, web development is not that well integrated. WTP is still buggy, there are issues with configurations, deployment and so on.

Update: Fifth, autocomplete should put jdk classes/interfaces first!!! This is so important. Screenshot:

WTF is antlr.collections?! Are you kidding me?

Now, I'm trying to launch a main method without the "String... args" parameters and Eclipse cannot find it. This is also a longstanding problem.

This works:

public static void main(String... args)

This does not (eclipse cannot find the method):

public static void main()

I'm pretty sure there's a solution, but I'm not going to waste time searching for it.

I've wasted time with compilation, memory, various configurations with xml and whitespace also.

There are always solutions, but this is wasted time. What are the developers working on? Stupid pointless features? Fix these please. Please.

Why is java development so windows oriented?!

I'm using a macbook. Obviously I'm using Mac OS. Not so obviously actually - recently I saw a few people using Windows 7 on a macbook.

JDK. Developing java applications on a Mac OS is not so straightforward as it is on windows. When you start on Windows, the first thing you do is download the JDK - that's easy. On Mac OS you don't have a real JDK, you have Java for Mac OS X. It's not the same. It's always late. Using SoyLatte they made a darwin port called openjdk6 that is a lot more like a real JDK. With JavaSE 7 it's even worse - there are binaries for Windows, on Mac OS one has to build it manually which is not that easy.

Eclipse. Then there's Eclipse. Thank god - there's an Eclipse.dmg that is pretty easy to install. But (there's always a but), the shortcuts are a bit changed. Alt+Shift+X becomes ⌘+⌥+X. There's also the speed issue - Eclipse is not as fast on Mac OS as it seems on a Windows machine.

Browsers. One major setback is that if one does front-end, one needs Internet Explorer to test. Otherwise QAs come and kick one's ass because something doesn't work on IE6 for example. I hate Internet Explorer. Not only IE6, all of them.

Configuration. In my project I have:

File file = new File(element.replace("file:", ""));

my Windows-using colleagues have

File file = new File(element.replace("file:/", ""));

The good thing is that since Mac OS is unix-based I have the settings that are closer to the Ubuntu we deploy our production on.

I don't know - maybe I should buy a new Macbook with a fast SSD with a lot more juice into it than the one I have now (a two-year-old one that hasn't been reinstalled since). Now there's the question - should I buy the 13" or the 15"?

P.S. The things are getting a lot better. OpenJDK6 port is pretty mature (I use it), OpenJDK7 port is coming soon. Apple donated it's JavaSE port to Oracle, so soon Java's download page would feature a .dmg file, which will be awesome.

Still I think developing java apps on a macbook is a bit harder than on a Windows machine. I wouldn't go back to Windows because of the awesome hardware and because the OS is so much better for anything else.

How to make Eclipse validate XSL (and of course XML) files

Intro on Eclipse

Eclipse has two major bundles:

  • Eclipse IDE for Java Developers
  • Eclipse IDE for Java EE Developers.

Info here: http://www.eclipse.org/downloads/

The major difference is that Eclipse for JavaEE includes the Web Tools Platform (WTP). WTP has editors, designers, JavaEE perspective, new projects and so on.

I generally prefer to use the ‘Java’ perspective as opposed to the ‘JavaEE’ perspective, because the latter is too cluttered, but the one thing from WTP without which I cannot live is the XML editor. There are variations for XSL transformations and XML Schemas.

XML Schemas (XSD)

By default Eclipse can validate XML Schemas, because it has the schema for XSDs. Did you get this one? Let’s try again. XSD is a language written in xml that defines rules for xml files who want to conform to certain rules. This allows us to validate such files versus a schema. Finally XSD is also XML, so there is a special XSD Schema that defines how to write XSD Schemas. And the dog catches its tail.

XML Schema language is also defined in DTD. DTD is the predecessor of XSD.

Anyway, if you want to learn more, go to W3C Schools - the best place to learn XML, XSD, XSLT. This is also the official site of WWW Consortium (W3C) which handles the expert groups that define these standards.

Where is XSL.xsd?

XSL is written in xml, so there is an XSD Schema that defines how to write XSL files.

The schema for XSLT 2.0 (2007 revision) is here: http://www.w3.org/2007/schema-for-xslt20.xsd (the most up-to-date)
The DTD for XSLT 1.0 (1999 revision) is here: http://www.w3.org/TR/1999/REC-xslt-19991116.xml (I couldn’t find XSD for XSL 1.0, maybe because XSL 1.0 is too old)

So the only thing I need to do is put XSL.xsd in Eclipse?

Yes. Here’s how: go to Window –> Preferences and then to XML –> XML Catalogs:

(XML Catalogs are a very interesting topic. There’s an article on them in this blog here)

Eclipse 3.5 preferences

Then "Add”:

Add XML Catalog from http

There are 3 ways to add an XML Schema to Eclipse

  1. Via an URL (as in the picture)
  2. Via a workspace location
  3. Via a file on the file system

How do we validate?

Here’s how:

Validate button in Eclipse

Via the "Validate" button on the context menu on any XML/XSL file.

The exact same thing can be performed for any XML File that has to be validated against an XML Schema (or DTD, of course)

@Override in eclipse

When one implements an interface, the template in Eclipse puts an @Override and it does not complain about it. Ant javac task also compiles without warnings.

Sometimes other Eclipse instances start to complain exactly for that @Override stating that there's no method that's overridden. Well, Eclipse, please do make up your mind.

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Override.html
"Indicates that a method declaration is intended to override a
method declaration in a superclass. If a method is annotated with
this annotation type but does not override a superclass method,
compilers are required to generate an error message."

Well, that's not very clear. As far as I remember an Interface is a pure abstract class, right? So, which one's correct.

P.S. Sometime ago I was having a similar problem with Eclipse and generics - Eclipse only gave a warning about something (can't remember what exactly), but the javac said that it was an error - Google said something like "eclipse uses jikes, you use javac". So what, aren't there specs?!

Update: apparently JDK5 (or 1.5, suit yourself) does not allow that. So in order to get all the wrong @Overrides - set the Compliance level to 5.0 (Eclipse -> Window -> Preferences -> Java -> Compiler -> Compiler compliance level ) - and..... correct them. I have 29 left.