Java X(

Started by
3 comments, last by the_edd 13 years ago
Most of the coding I've done throughout my life has been in either C or C++. I've done quite a bit of Java, but have been unable to complete anything substantial with it because of various little annoyances. I normally do my coding in Gedit for its simplicity, and simply type 'make' into the command line to build my program. But writing a makefile for a Java based app isn't as clean as it should be. When writing a C/C++ app, GCC can generate a dependency list for each source file. When any of the dependencies (headers) are modified, make knows to recompile the source. But in Java, if, for example, I change the constant 'ClassOne.CONSTANT' which is used by 'ClassTwo', there's no way for make to know that 'ClassTwo' should be rebuilt. I've searched for dependency generators with no luck.

After giving up on the simple command line + text editor style of development for Java, I tried out a few IDEs. I liked JCreator, but this appears to be for only Windows, which I try to avoid whenever I can. I also tried NetBeans and Eclipse, both of which I find completely unusable. Both of them try to write code for you, such as increasing indentation, writing closing brackets, and inaccurately predicting which method name I'm writing. And it appears that some of these annoying features are impossible to disable. Is there a single Java IDE out there with a text editor whose only purpose is to edit text?

Before giving up on Java development forever, I'd like to see if there are any other options that you guys think may suit me. Any help is appreciated ;)

Advertisement
Ok, to answer the question directly, why not just use your favorite text editor and Apache Ant?

See http://ant.apache.org/

Its the de-facto standard Java build tool.

Also, I think you have some misconceptions about how Java's compilation model works. In your given example, you do not need to rebuild ClassTwo.

Edit: You might also want to peruse http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html Javac will automatically recompile dependencies if necessary and it finds the source code (i.e. specified on the sourcepath). But again, in cases like the one you outlined, recompilation is not necessary.
Adding to what Rycross already said, my experience with Eclipse is that you can configure practically everything, including what (and if) indentation and bracket placement is to be used, even though it can be a bit of a challenge the first time you try to configure it.
Apache's "Maven" is another popular build system.

You can generally disable all that stuff in your IDE. It is actually helpful though, you can configure it to indent the way you want, and auto-complete is just plain handy so you don't need an API reference handy.

It might take some getting used to if you started with a "raw" experience. I used to be the same when I first started out programming. Now that I write bigger and more complex applications using a diverse set of libraries I appreciate that using proper tools saves me time.

If nothing else using an IDE will give you an excellent debugger, which is invaluable at times.

Also, I think you have some misconceptions about how Java's compilation model works. In your given example, you do not need to rebuild ClassTwo.

But your build system (or often your IDE in the case of Java) at least needs to check. If ClassTwo imports ClassOne, and ClassOne.java has changed then ClassTwo *might* need recompiling because without identifying exactly what in ClassOne changed you can't be sure that recompilation isn't necessary. Java dependencies such as this are incredibly difficult to express in a make-style dependency graph.

I'd actually go so far to say that to achieve anything close to minimal recompilation in Java builds, you really *need* a Java-aware IDE. An off-the-shelf DAG-driven build system will always struggle to get this right.


Edit: You might also want to peruse http://download.oracle.com/javase/6/docs/technotes/tools/windows/javac.html Javac will automatically recompile dependencies if necessary and it finds the source code (i.e. specified on the sourcepath). But again, in cases like the one you outlined, recompilation is not necessary.
[/quote]
If you go this route and use make be very careful, as it will introduce race conditions in to parallel builds, potentially producing corrupt .class files.

This topic is closed to new replies.

Advertisement