Have a Nice Steaming Cup of Java 5 859
wap writes "The language/VM/religion that everyone loves to hate is now serving another cup: Java 1.5 is ready for download. The new features of 1.5 have been discussed here before. I, for one, welcome our new virtual machine overlord. I have been using the release candidate, and startup times are noticeably faster, as is overall performance, and the new features like typesafe collections and static imports are great to have. Let the Java flames begin!"
Finally! (Score:4, Informative)
Release notes (Score:5, Informative)
Comment removed (Score:3, Informative)
Re:How long will the MacOS X release take? (Score:2, Informative)
Re:Stability/memory leaks (Score:2, Informative)
What an appropriate sig for your comment. The simple fact is that Java memory leaks are pretty common simply because not enough planning goes into coding. A proper UML diagram of an application can go a long way to highlighting possible memory leak situations.
The new for loop and type safe collections rock (Score:5, Informative)
It would be nice though if Sun would make Groovy or Jython a standard part of their java distribution. That would definitely make it competitive with
It's out there! (Score:3, Informative)
I gave it a whirl about a year ago and it was fine, fine for the relatively simple stuff I experimented with.
J.
Re:J2EE -- 1.3.1 still (Score:3, Informative)
Re:Stability/memory leaks (Score:2, Informative)
Also, I don't know for sure, but would what happen if two objects referenced each other but nothing else referenced them. Would gc know to follow the links between the two and see that nothing in the main app is using them?
Re:Still no operators... (Score:4, Informative)
> I guess this will finally come but when ?
Errr...
Java 1.4 was comparable in speed to C++ [idiom.com] (except obviously for Trig which got a huge overhaul in 1.4 and slowed down some)
It really depends how you write you code... Sloppy C++ code can be slow too..
Re:Stability/memory leaks (Score:4, Informative)
Yes, Java's GC would notice that nothing is referring to them and remove the objects. This unlike a simple reference counting gc such as python's which would not notice this. Java's GC can even relocate memory on the fly to minimize page misses and avoid memory fragmentation.
Re:How long will the MacOS X release take? (Score:4, Informative)
But by your post, you had probably already guessed that. At least it's probably less than four years, like it was before Mac folks got JDK 1.2...
Re:Stability/memory leaks (Score:2, Informative)
Java supports various types of references, check here: http://java.sun.com/j2se/1.4.2/docs/api/java/lang
Re:hmm. but how does this compare with Mono (Score:3, Informative)
Despite the having a slower VM, the
But back to Mono it will probably never be able to catchup speedwise with
Re:J2EE -- 1.3.1 still (Score:4, Informative)
However, your ClassCastExceptions will only get bumped to compile time in JDK 1.5, true. But I must admit that in eight years of Java programming, I've never had this particular problem where it didn't take more than a few seconds to find the source of the bug.
I really just want the metadata stuff (which was obviously ripped off from C#, but it's a great idea). That, and EJB 3.0, which gets rid of the stupid deployment descriptors.
Re:How long will the MacOS X release take? (Score:4, Informative)
Not really. CodeGuide, www.omnicore.com, thats an IDE, has a MAc release since years. That allows using Java 1.5 features in coding. And as you can create byte code compatible with JDK 1.4 released software will run on a Mac as well. Tehre are minor issues however e.g. new methods in java.lang.String wich work fine in the IDE (becase the classpath is different) but not in standalone mode. Nevertheless, I'm coding on a Mac, not necessaryly for a Mac, thats why I use java with generics and the later Java 1.5 betas since over 2 years now. (And since about 14 month on a Mac).
I would expect that Eclispe and other major IDE vendors have a Mac version bundled with JDK 1.5 runtime libraries as well.
angel'o'sphere
Re:Bytecode Compatibility (Score:5, Informative)
Re:Write once, run anywhere (Score:2, Informative)
Maybe you can't find it on the shelf at a retail computer store, but it is a for-purchase product. (Free to download and play with, of course.)
Swing on OpenGL (Score:5, Informative)
This does indeed work too, I have played around with it and graphically intensive Swing applications really fly with OpenGL activated (given that your graphics card and drivers are sufficiently bug-free and modern). Read about it here [sun.com]
And yes, it does work under Linux, and Windows and Solaris (and most likely will under OS X, though that is up to Apple to implement).
Even without OpenGL acceleration the Swing responsiveness improvements are very impressive, coupled with the much better both default theme and theme mimicking in 1.5 I'd say it is time to retire the Swing troll.
Eclipse 3.1 betas (Score:5, Informative)
Re:Stability/memory leaks (Score:4, Informative)
Yes, Java's GC would notice that nothing is referring to them and remove the objects. This unlike a simple reference counting gc such as python's which would not notice this.
Your information about Python is about four years [python.org] out of date.
Re:How long will the MacOS X release take? (Score:5, Informative)
Perhaps because it will work on the #1..n server OSes?
Re:Still no operators... (Score:2, Informative)
"""
Consider what happens when you do a new/malloc: a) the allocator wanders through some lists looking for a slot of the right size, then returns you a pointer. b) This pointer is pointing to some pretty random place.
With GC, a) the allocator doesn't need to look for memory, it knows where it is, b) the memory it returns is adjacent to the last bit of memory you requested. The wandering around part happens not all the time but only at garbage collection. And then (depending on the GC algorithm) things get moved of course as well.
"""
The guy knows nothing about _either_ efficient dynamic memory allocators, nor garbage collectors, he has no right to pass comment on them.
FP.
No you can't run it anywhere you like! (Score:4, Informative)
Justin.
Re:I wait! (Score:2, Informative)
Re:J2EE -- 1.3.1 still (Score:3, Informative)
Re:I for one . . . (Score:1, Informative)
Performance improved? Not in my experience... (Score:3, Informative)
Test I did: Run 'ant -lib lib checkstyle java' on XINS [sf.net] 0.207)
Preparation command: Timed command: I did 3 tests in a row for each Java version. I added the 'user' and 'sys' times and the averaged then. Results on my Gentoo Linux system with 2.6 kernel:
Re:Passe... (Score:2, Informative)
New Features in Java 5:
- Generics (C# 2.0)
- Enumerated types (C# 1.0)
- Static import (not available in C#)
- Formatted output / input (C# 1.0)
- Varargs (C# 1.0)
- for loop changes (C# 1.0, equiv foreach)
- autoboxing (C# 1.0)
- metadata (C# 1.0)
In C# 2.0, it will have features that Java 5 does not support:
- iterators
- anonymous methods (includes support for closures)
- nullable types
- partial classes (good for code generators)
Not saying C# is the be all end all... in fact, I'm more partial to languages like Ruby.
Re:J2EE -- 1.3.1 still (Score:1, Informative)
Re:Bytecode Compatibility (Score:5, Informative)
But what about your classpath, does it reference the 1.5 JRE? E.g. if the 1.5 java.lang.String gets loaded by an old JVM you might get that errro as well.
angel'o'sphere
Re:Bytecode Compatibility (Score:5, Informative)
The bytecode format is still identical. The version number on the file was incremented because classes that depend on assertions could break badly if used on a JVM that doesn't implement them (which is actually a feature of a few classes in java.lang, not a bytecode interpreter feature). Use the '-target' commands recommended by the other posters whenever producing code that doesn't rely on one of the new features.
Re:No you can't run it anywhere you like! (Score:1, Informative)
Re:The language wars never ceases to amaze me (Score:1, Informative)
Re:How long will the MacOS X release take? (Score:1, Informative)
Java already supports Linux.
Why build it? (Score:1, Informative)
With that in mind, I've actually built some parts of it with 1.5 and they were fine.
Re:Generics (Score:2, Informative)
Re:Passe... (Score:1, Informative)
I know it's somewhat nit-picking, but generics are named differently for a very good reason, template meta-programming (the oh-god-it's-hard-to-get-your-head-around c++) is just not something that java generics, or c#'s upcoming similar feature do.
Re:Dear Sun (Score:5, Informative)
1) go to java.com [java.com]
2) click the big "get it now" button
3) download the EXE
Now quit trolling.
Re:Stability/memory leaks (Score:3, Informative)
Yes, Java's GC would notice that nothing is referring to them and remove the objects. This unlike a simple reference counting gc such as python's which would not notice this. Java's GC can even relocate memory on the fly to minimize page misses and avoid memory fragmentation.
Python actually uses a generational garbage collection system that can break cycles to reclaim unused objects. It also performs certain optimizations to avoid unnecessary memory allocations and deallocations.
In Python, reference counting is a combination of a historical artifact and a performance optimization.
Re:Passe... (Score:5, Informative)
My apologies for the horrible look of the code samples. Slashdot won't let me use nice, short lines, as it results in lines which are too short. Gah! Apparently I need ~40 characters per line (average) to get past the @#$% filter... This has to be the most annoying filter I've ever come across; I've spent more time getting past the filter than responding to your question!
Iterators are similar to java.util.Iterator. C# iterators are compiler support for implementing the System.Collections.IEnumerator interface. For example, in Java you'd write:
C# iterators make this much easier:
C# iterators are particularly useful when implementing your own collection objects. Google for them; they're very powerful.
Anonymous Methods are methods without a name, just like Java anonymous classes are classes without a name. Same basic idea, fewer braces. They also act as full closures; while Java requires that all stack variables referenced from an anonymous class be final, C# doesn't require this.
The above example is bad, but you can let your imagination run wild. This is very useful for event handlers.
Partial Types
allow you to split a single class definition across multiple files. This is useful to prevent > 50 KB source files (yech!), and makes it easier to have part of a class machine generated (by a GUI builder) and part hand-written. Some people hate it, others are ambivalent, but it can be handy:
Nullable types are primarily useful for database support in the .NET type system. DB types can be "nullable" -- not present. For reference types, this is easy -- use null. For .NET value types, this isn't possible, as value types can't be null. The solution is to introduce a generic class System.Nullable<T>, which can wrap value types such as int.
The C# compiler adds syntactic sugar to this, to simplify usage:
Nullable types are more special purpose, but are useful for those who need them.
Ignore the rest of this: it's just garbage to get past Slashdot's wonderful "too few characters per line" problem: lk jfjdlkajdsfl;kja sdfl;kja fjklsafjd l;kj lasjd lkjds fl;kja sdflkajsd lkj afs lk jfjdlkajdsfl;kja sdfl;kja fjklsafjd l;kj lasjd lkjds fl;kja sdflkajsd lkj afs lk jfjdlkajdsfl;kja sdfl;kja the quick brown fox jumps over the lazy dog l;kajdsfl;kj;lkj l;kjasdilfj l;kjoiewqruq[op 0-9314u75 lkfjx ;lkajdsfmopiac un0p3u5n1-0329u kl 0a9u 3214o5ilj hello out there in tv land! q 09
Re:STUPID MODS (Score:5, Informative)
Thought not.
Re:I love the hate (Score:3, Informative)
Here [slashdot.org] it is.
Re:I wait! (Score:2, Informative)
Re:Passe... (Score:3, Informative)
Java, unlike C++, has a policy of putting features off to become future extensions any time the language team can't specify them right at the time. C++ is constantly finding that changes they need to make break things that they've been recommending. Java's main mistake so far has been that they didn't have arrays use generic types, so the two don't play quite right together. Of course, that was a matter of historical necessity, because Java wouldn't have gotten to the point where generic types were worked out correctly without supporting arrays.
Netbeans 4.0 Beta 2 (Score:3, Informative)
Netbeans 4.0 Beta 2. [netbeans.info]
J2SE 5.0 bundled with Netbeans. [sun.com]
Re:Passe... (Score:5, Informative)
For example
Re:I wait! (Score:2, Informative)
Don't forget the \b for word breaks, or you might end up with something a little different than you intended.
Re:Thanks to our supporters (Score:3, Informative)
I hate to say this, but: your cut is the fact you can use it for free!
I hate to say THIS but that money DID come from me over the course ten years of PC systems with buggy operating systems on them.
Maybe I should just get a linux PC next time and install Windows if I need it.
Re:hmm. but how does this compare with Mono (Score:3, Informative)
some others it is a lot faster. The areas that
get the most testing and use from the team are
likely to be more tuned than the Microsoft
counterparts (this is a nice benefit of using
Mono to develop itself: we actually use it to
maintain our own compilers, editors, and day-to
day tools).
You are mistaken about the JIT nature of Mono,
Mono has an optimizing JIT engine with pluggable
optimizations. You can control the level of
optimizations using the -O flag to the runtime,
and we support Ahead-of-Time compilation as well
which means that you can turn on all the obscene
optimizations (those who might be too expensive
to do at JIT time, and that historically JITs
had to implement by doing dynamic recompilation).
In our case, we turn on all the expensive
optimizations, and run the code natively, without
a dynamic translation (like a JIT would do).
Anyways, Mono has a dedicated staff to support
and maintain it (16 developers reporting to me,
plus other contributors from Novell in other
areas of the VM) in addition to the 250 accounts
for external contributors that continue to
improve Mono.
We are not in a quest to compete with Java, we
bring something different to the table (and in
fact, we even support Java in Mono
statements are incorrect.
Miguel.
Remembering experience (Score:2, Informative)
Was Java one of the main reasons for the big success of the product and the company? Quite possibly so.
Would the company have succeeded had not Java been chosen? Perhaps, with a bit of luck.
If Java was such a crap as it's often depicted, would this be possible at all? I very much doubt it.
Re:Stability/memory leaks (Score:4, Informative)
However, you are quite correct. It can be quite difficult at times to ensure that all objects are correctly cleaned up after usage. As soon as you introduce items such as HashMaps, etc, you run into potential for these problems.
We once had this issue when we embedded the mozilla javascript interpreter in our app. The problem was that you have to create a scope object, with all sorts of predefined classes and functions and so forth. This was expensive, so we pooled them. Unfortunately this left a memory leak, as objects declared in scope by the javascript itself would not tidy up at the end of processing.
Indeed it turns out the library has parent scopes, so we could create a new child scope cheaply each time, but the point remains.
Re:Stability/memory leaks (Score:2, Informative)
One algorithm to do GC is to go through every reference in your call stack, follow each of them, mark the object you reach as used, do the same for each reference in those objects, and so on (taking care to check for already-marked objects, so as not to fall into cycles). Then, you go through all the heap, and free all the objects you didn't mark.
This algorithm will successfully collect the circular list. I don't think Java uses this one algorithm, but the algorithms it does use will collect the cyclic structures just as well.