Zeitplan für Java 9 bekannt
2015-12-10 Feature Complete 2016-02-04 All Tests Run 2016-02-25 Rampdown Start 2016-04-21 Zero Bug Bounce 2016-06-16 Rampdown Phase 2 2016-07-21 Final Release Candidate 2016-09-22 General Availability
http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-May/002172.html
Java SE 8u45 verfügbar
Wie man schon gewohnt ist mit Sicherheitsupdates. Details und Download unter http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html, http://www.oracle.com/technetwork/java/javase/documentation/8u-relnotes-2225394.html, http://www.oracle.com/technetwork/java/javase/8u45-relnotes-2494160.html, http://www.oracle.com/technetwork/java/javase/2col/8u45-bugfixes-2494164.html.
So viel ist vom Bug-Fixing aber nicht passiert.
Keine (öffentlichen) Oracle JDK 7 Updates mehr
So wie es Oracle schreibt: http://www.oracle.com/technetwork/java/javase/overview/index.html:
Coincident with the January 2015 CPU release users with the auto-update feature enabled will be migrated from Oracle JRE 7 to Oracle JRE 8. Also, please note the April 2015 CPU release will be the last Oracle JDK 7 publicly available update. For more information, and details on how to receive longer term support for Oracle JDK 7, please see the Oracle Java SE Support Roadmap.
DemoFX: Demoprogrammierung mit JavaFX
https://www.youtube.com/watch?v=N1rihYA8c2M
https://www.youtube.com/watch?v=WZf0j4GUFYM
Nett gemacht, voll 80er, Code unter https://github.com/chriswhocodes/DemoFX.
Java in den Sony-EMails
Ich habe einmal in den https://wikileaks.org/sony/emails/ nach Java gesucht und (auf den ersten Blick) nichts interessantes gefunden.
EMails Search
Viele Werbe-EMails stammen von Azul (“Zing® now available for Java 8”, “Azul Zulu now available for Java 8”), einige Reiseplanungen, doch das hat mich zum Lachen gebracht:
Couple hundred dollars for Cambodia and Java (not sure what the dollar is called in Java. Maybe it’s the same?)
Und echt banales wie
you’ve been on my mind…
When things quite down (ha!) I’ll come by for a cup of morning java.
Sending you much love.
XXXXXXXXXXXXXXXX
Documents Search
Das ergibt nach Java satte 30.287 Ergebnisse. Darunter Dokumente wie https://wikileaks.org/sony/docs/05/docs/eBooks/Hacking_The_Next_Generation.pdf (Hier sind viele PDFs von O’Reilly verlinkt, wer also “günstig” an Ebooks kommen will …)
Viele Dokumente sind Specs aus diversen Quellen zusammengesammelt.
Findet ihr was Spannendes?
Interessante Präsentation: Performance Tuning Where Java Meets the Hardware
Neue Termine für öffentliche Java-Seminare in Dortmund
☑ Java Grundlagen: 04.05.-08.05.15 (KW 19), 29.06.-03.07.15 (KW 27), 07.09.-11.09.15 (KW 37), 02.11.-06.11.15 (KW 45)
☑ Java für Fortgeschrittene: 18.05.-22.05.15 (KW 21), 20.07.-24.07.15 (KW 30), 28.09.-02.10.15 (KW 40), 23.11.-27.11.15 (KW 48)
☑ Java für C#-/C++-Umsteiger: 13.04.-17.04.15 (KW 16), 08.06.-12.06.15 (KW 24), 17.08.-21.08.15 (KW 34), 19.10.-23.10.15 (KW 43)
Xbox 360 Kinect unter Java ansprechen
- Windows anmachen 🙂
- Kinect mit dem USB-Power-Adapter anstöpseln.
- Unter http://www.microsoft.com/en-us/download/details.aspx?id=40278 das Kinect for Windows SDK v1.8 laden und. (Nicht Version 2!) Die grüne Lampe wird leuchten.
- Unter dem Geräte Manager wird Kinect angezeigt:
- Optional: Für ein paar Beispiele installiere von http://www.microsoft.com/en-us/download/details.aspx?id=40276 das Kinect for Windows Developer Toolkit v1.8.
Unter Developer Toolkit Browser v1.8.0 (Kinect for Windows) kann man dann Beispiele anschauen und prüfen, ob die Kamera einen “empfängt”. - Gehe unter http://research.dwi.ufl.edu/ufdw/download.php und lade ufdw.jar. Melde das Jar im Klassenpfad an.
- Lade ein Beispiel von http://research.dwi.ufl.edu/ufdw/j4k/examples.php, entpacke es, und setze für ein 64-Bit-Java die DLL-Dateien (ufdw_j4k_64bit.dll/ufdw_j4k2_64bit.dll) in das Java-Projekt.
Das waren die Vorbereitungen, jetzt können wir zum eigentlichen Java-Programm kommen. Zum Testen soll einfach nur die Orientierung (also der Winkel zur Kinect) in den Winkel einer 3D-Box übertragen werden – dreht man sich vor der Kinect, wird die Box sich mitdrehen. Gleichzeitig gibt es noch einen Text, sodass man den Winkel gleich ablesen kann.
Fertig sieht das so aus:
import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.shape.Box; import javafx.scene.text.Text; import javafx.scene.transform.Rotate; import javafx.stage.Stage; import edu.ufl.digitalworlds.j4k.J4KSDK; import edu.ufl.digitalworlds.j4k.Skeleton; public class MovingBody extends Application { private final Box box = new Box( 200, 200, 200 ); private final Text text = new Text( 200, 200, "#" ); class SkeletonTracker extends J4KSDK { @Override public void onSkeletonFrameEvent( boolean[] skeletonTracked, float[] positions, float[] orientations, byte[] jointStatus ) { int skeletonId = 0; while ( !skeletonTracked[ skeletonId ] ) skeletonId++; Skeleton skeleton = Skeleton.getSkeleton( skeletonId, skeletonTracked, positions, orientations, jointStatus, this ); box.setRotate( (int) skeleton.getBodyOrientation() ); // reduce "noise" with (int) text.setText( "" + (int) skeleton.getBodyOrientation() ); text.setRotate( (int) skeleton.getBodyOrientation() ); } @Override public void onColorFrameEvent( byte[] colorData ) { } @Override public void onDepthFrameEvent( short[] depthFrame, byte[] playerIndex, float[] xyz, float[] uv ) { } } public MovingBody() { new SkeletonTracker().start( J4KSDK.SKELETON ); } @Override public void start( Stage primaryStage ) { Group root = new Group(); primaryStage.setScene( new Scene( root, 400, 400 ) ); primaryStage.show(); box.setTranslateX( 200 ); box.setTranslateY( 200 ); box.setTranslateZ( 200 ); box.setRotationAxis( Rotate.Y_AXIS ); root.getChildren().addAll( box, text ); } public static void main( String[] args ) { launch( args ); } }
RoboVM erreicht Version 1.0
RoboVM erlaubt es, Java-Anwendungen für iOS und auch Android zu compilieren.
Ankündigung unter http://robovm.com/robovm-1-0-released-commercial-licenses-a-look-under-the-hood/.
Gegenüber der alten Version:
- The debugger has received another round of updates. All JDWP functionality is now implemented.
- Support for RAM disk caches. This can help speed up the compilation and linking process on slow HDDs.
- Support for HFS+ file compression. All files put into the cache are now compressed, further speeding up the compilation process and reducing the amount of space used for the RoboVM cache.
- Initial project template and Maven archetype support.
- A new Eclipse project wizard, using the templates project
- Support for invoking tools via robovm.xml. We currently support the TextureAtlas tool, with more to come.
- Cleanup and simplification of Objective-C bindings, see the binding status page
Neu ist eine kommerzielle Lizenz:
Our commercial license scale with the size of your business, covering solo developers, startups, SMEs and big enterprises. Depending on your plan, you’ll get access to the following features and services:
- JDWP compliant debugger for both simulator and on-device debugging
- Improved crash reporting
- Private e-mail support, with and without SLA
- JavaFX support
- Hotfix support
- Alpha channel access to new commercial features
Offtopic: Praktikumsstellen verfügbar
Die Digitale Erlebnis-Center GmbH beschäftigt sich seit April 2011 intensiv mit dem Aufbau eines PC-/und Spiel-Konsolen-Museums.
Aufgaben
– Gestaltung und Entwurf interaktiver Oberflächen unter Berücksichtigung existierender Frameworks
– Auswahl und Integration von Emulatoren für Computer und Spiel-Konsolen in der musealen Gestaltung
– Recherchetätigkeiten und Erstellung von Texten über Hardware und Software
Qualifikation
– Kreativität und eine hohe Internetaffinität, praktische Erfahrung in HTML, CSS3, JavaScript. Java ist von Vorteil
– Praktische Erfahrung in Linux, Windows und grundlegender Systemkonfiguration
– Systematische, strukturierte und selbstständige Arbeitsweise mit hohem Qualitätsbewusstsein
– Team- und Kommunikationsfähigkeit, gut und sicher im Ausdruck
– Hintergrundwissen über Computer der 1980er Jahre und der Computerspielszene sind von Vorteil
Wir bieten
– Freundliche Arbeitsatmosphäre und Unterstützung bei beruflicher und persönlicher Weiterentwicklung
– Eigenverantwortliche Gestaltung des Aufgabenbereichs unter Einbringung eigener Präferenzen
– Freie Arbeitszeitgestaltung durch Heimarbeit
– Das Praktikum wird gering vergütet
Folien der GWT.create-Konferenz online
Schöne Neuerungen in GWT 2.8 und der kommenden Version GWT 3.0.
Folien unter http://gwtcreate.com/slides/. Google Inbox nutzt auch GWT und für iOS den Compiler J2ObjC. Cool! Siehe auch https://github.com/Sfeir/jhybrid.
Heute feiern wir …
… den Pi-Day (https://de.wikipedia.org/wiki/Pi-Tag).
Er findet jedes Jahr am 14. März statt und geht zurück auf die US-amerikanische Datumsschreibweise 3/14 oder die ISO-Schreibweise -3-14, denn der numerische Wert von π auf zwei Dezimalen gerundet ist 3,14. Besonders genaue Anhänger dieses Tages feiern um 1 Uhr 59 und 26 Sekunden und erreichen die Kreiszahl damit bis zur siebten Nachkommastelle, 3,1415926. Im Jahr 2015 wird Pi um 9 Uhr 26 und 53 Sekunden sogar das erste mal, durch die Passende 15 der Jahreszeit bis zur neunten Nachkommastelle erreicht.
Java Mission Control 5.5.0 freigegeben
Details bei http://hirt.se/blog/?p=646. Bestes Feature, keine Schalter mehr beim Start der JVM, das kommt “dynamisch”:
JDK 8u40 freigegeben
http://www.oracle.com/technetwork/java/javase/8u40-relnotes-2389089.html.
Und es sind interessante Neuerungen dabei.
The endorsed-standards override mechanism and the extension mechanism are deprecated and may be removed in a future release. There are no runtime changes. Existing applications using the ‚endorsed-standards override‘ or ‚extension‘ mechanisms are recommended to migrate away from using these mechanisms. To help identify any existing uses of these mechanisms, the
-XX:+CheckEndorsedAndExtDirs
command-line option is available.
Grund dafür ist das neue Modulsystem,was in Java 9 kommt.
Und:
Starting with JDK 8u40 release, JavaFX controls are enhanced to support assistive technologies, meaning that JavaFX controls are now accessible. In addition, a public API is provided to allow developers to write their own accessible controls.
JDK 8u40 release includes new JavaFX UI controls; a spinner control, formatted-text support, and a standard set of alert dialogs.
Viele Bugs wurden gefixt: http://www.oracle.com/technetwork/java/javase/2col/8u40-bugfixes-2423829.html
Average number of lines per method in the JDK
The JDK itself can help us to count the lines of code, we just need to parse the source and get the method bodies in a String representation–then we can count the lines. A quick statistic from the new Java 8 Stream API will give us the numbers.
Code first:
import java.io.IOException; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.*; import javax.tools.JavaCompiler; import javax.tools.JavaCompiler.CompilationTask; import javax.tools.StandardJavaFileManager; import javax.tools.ToolProvider; import com.sun.source.tree.CompilationUnitTree; import com.sun.source.tree.MethodTree; import com.sun.source.util.JavacTask; import com.sun.source.util.TreeScanner; public class AverageNumberOfLinesInJDKFinder { public static void main( String[] args ) throws IOException { String[] files = findAllJavaSourceFiles( "C:/Program Files/Java/jdk1.8.0/src/" ); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); try ( StandardJavaFileManager fileManager = compiler.getStandardFileManager( null, null, null ) ) { CompilationTask task = compiler.getTask( null, fileManager, null, null, null, fileManager.getJavaFileObjects( files ) ); JavacTask javacTask = (JavacTask) task; Iterable<? extends CompilationUnitTree> trees = javacTask.parse(); LineCountingVisitor lineCountingVisitor = new LineCountingVisitor(); for ( CompilationUnitTree compilationUnitTree : trees ) compilationUnitTree.accept( lineCountingVisitor, null ); DoubleSummaryStatistics stats = lineCountingVisitor.numberOfLines.stream().mapToDouble( d -> d ).summaryStatistics(); System.out.println( stats ); } } static String[] findAllJavaSourceFiles( String base ) throws IOException { final List<String> result = new ArrayList<String>(); Files.walkFileTree( Paths.get( base ), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile( Path path, BasicFileAttributes attribs ) { if ( path.toString().endsWith( ".java" ) ) result.add( path.toString() ); return FileVisitResult.CONTINUE; } } ); return result.toArray( new String[result.size()] ); } } class LineCountingVisitor extends TreeScanner<Void, Void> { final List<Integer> numberOfLines = new ArrayList<Integer>( 2048 ); @Override public Void visitMethod( MethodTree node, Void p ) { if ( node.getBody() != null ) { int lines = new StringTokenizer( node.getBody().toString(), "\n" ).countTokens() - 1 /* { */ - 1 /* } */; if ( lines != 0 ) // ignore empty bodies numberOfLines.add( lines ); } return super.visitMethod( node, p ); } }
Result:
DoubleSummaryStatistics{count=84695, sum=576427,000000, min=1,000000, average=6,805915, max=1716,000000}
Exercise for the readers:
- Analyse different open source products and post the results here.
- Generate a SVG with the lines of code.
- Change the calculation so we not only get the arithmetic mean but also the geometric and harmonic mean.
- Sort the result by package, are there differences?
- Recognize the @since Javadoc tag and try to find out if the number of lines change over time.
- How about the line size?
Avatar verabschiedet sich
Mal wieder geht ein Java-Oracle-Projekt den Bach runter, dieses mal Avatar/Avatar.js (Quelle https://blogs.oracle.com/theaquarium/entry/project_avatar_update).
https://avatar-js.java.net/, https://avatar.java.net/
Avatar ist/war eine Art Node.js Implementierung in JavaScript auf der JVM.
http://nodyn.io/ ist eine spannende Altarnative, läuft aber auf einer eigenen JavaScript-Umgebung namens DynJS, nicht auf Nashorn.
Java Interfaces mit main-Methode
Statische Schnittstellenmethoden erlauben eine neue Möglichkeit zur Deklaration der main(…)-Methode:
interface HelloWorldInInterfaces {
static void main( String[] args ) {
System.out.println( „Hallo Welt einmal anders!“ );
}
}
Das Schlüsselwort interface ist vier Zeichen länger als class, doch mit der Einsparung von public und einem Trenner ergibt sich eine Kürzung von drei Zeichen – wieder eine neue Möglichkeit zum Längefeilschen.
Java Blog Aggregator: immer aktuelle Java-Nachrichten
http://www.topjavablogs.com/ aggregiert diverse Java-Blogs und bietet einen guten Einblick in die Java-Welt.
Java Open Source Libs Januar
Mustache (Apache). Sehr performantes Mustache-Templating-System für Java, benötigt Java 8.
Capsule (EPL). “Dead-Simple Packaging and Deployment for JVM Apps”. Im Kern ein Fat-Jar-Builder. Ermöglicht auch ausführbare WARs und Capsules können in Docker-Images konvertier werden. Alaternativ: One-JAR.
Pegdown Doclet (GPL 3). Markdown in Javadoc-Kommentaren statt HTML nutzen, inklusive PlantUML und Syntax Highlighting mit highlight.js.
The Checker Framework (GLP 2/MIT). Hängt sich in den Java-Compiler und führt zusätzliche Typ-Prüfungen (Null-Pointer, SQL-Injections, …) durch. Funktioniert toll mit Java 8, da nun an jeder Deklaration eine Annotation erlaubt ist.
Gradle (Apache). Gradle ist Ant in Groovy 🙂