Showing posts with label OpenJDK. Show all posts
Showing posts with label OpenJDK. Show all posts

Sunday, February 26, 2012

OpenJDK 7 on Apple G5 PowerPC on Mac OS X 10.5.8

Apple G5 Power Mac

  • Are you an Apple G5 owner feeling a little left out by Apple?
  • Do you have a very expensive and capable piece of hardware which can still be a valuable and fashionable?
  • Do you develop applications in Java, or run applications based on Java and feel left behind?

I have a solution for you! Use OpenJDK BSD Port!

Using a build script sent to me by Kurt Miller, build recommendations from Kelly O'Hair, and the great work of the BSD Port team... I created a new build of OpenJDK 7 for my PPC based system using the Zero VM.

The results are fantastic. I can run GlassFish 3.1.1 along with all my enterprise applications.

GlassFish 3.1.1 on Zero VM
Well it wouldn't be me if I didn't share my good fortune. I updated the Darwin9Build page for OpenJDK to demonstrate how to build OpenJDK for yourself. There are also links to the binaries too.

Here is the link: Darwin9Build


Wednesday, January 04, 2012

OpenJDK 1.7 with NetBeans 7.1 RC on Mac OS X 10.7

A question was posed to me the other day on how to use OpenJDK 1.7 on NetBeans on a Mac since there is only a Developer Preview available. I decided that a video does a better explanation. This applies to NetBeans 6+ as well when using JDK 7 on a default platform of JDK 6.



Saturday, November 06, 2010

JDK 7: The wait is over in OpenJDK

I did a presentation last month for our Greenville Java Users Group about the proposed features set for JDK 7. My claim is that they are already here in OpenJDK. Granted there still needs to be some fine tuning, but all of the proposed features will work.
You may need to turn on some JVM parameters to make them work, but they work.


JSR 292: Support for dynamically-typed languages (InvokeDynamic)

The following parameters need to be passed to the JVM:

-XX:+UnlockExperimentalVMOptions \
-XX:+EnableInvokeDynamic


An example of how this is implemented can be found at:

Support for Dynamically Typed Languages in the Java Virtual Machine

JSR TBD: Small language enhancements (Project Coin)

The simplified enhancements to improve developer productivity include:
  • Underscore separators for integral literals (primitive types).
  • "Diamond Operator" for simplified generic instance creation.
  • Strings in switch statements.

JSR 166y: Concurrency and Collections Updates

The best known reference is to ForkJoin operations from JavaOne, but it includes so much more. A great example of a Fork-Join operation can be found at: JSR-166: The Java fork/join Framework.

JSR 203: More new I/O APIs for the Java platform (NIO.2)

In the example at the bottom of the blog, I show the Path class. This includes some additional functionality where we expect "Files" and "Directories (path)" information to be separate.

A really cool new feature is the WatcherService API. This allows us to watch a file, or directory for changes. A great example can be found here: WatchDir.java.

This is just a few examples of the great things that are available in OpenJDK today. So if you want to try out the new features, download a binary distribution for your platform, or better still: download the source and build it yourself.

As promised here is my example code which demonstrates some of the features. You will need to download the ParallelMergeSort from the Fork-Join framework link above to compile it. Also if you are using NetBeans, it has a number of hooks already in place for OpenJDK (JDK 7/8).

Example.java

/*
 *  Copyright 2010 Blue Lotus Software, LLC.
 *  Copyright 2010 John Yeary <jyeary@bluelotussoftware.com>.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
/*
 * $Id: Example.java 304 2010-11-06 16:32:05Z jyeary $
 */
package com.bluelotussoftware.example.jdk7;

import java.io.File;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Arrays;

public class Example {

    public static void main(String... args) {

        Map<String, String> map = new HashMap<>();
        map.put("Hello", "World");
        System.out.println(map.get("Hello"));

        Map<String, Map<String, String>> multimap = new HashMap<>();
        Map<String, String> enclosed = new HashMap<>();
        enclosed.put("name", "value");
        multimap.put("map1", map);
        multimap.put("map2", enclosed);

        System.out.println(multimap.get("map2").get("name"));


        int x = 0b0_1;
        int y = 0b1000_0100_0010_0001;
        int z = 123___456___789___0;

        System.out.println(x);
        System.out.println(y);
        System.out.println(z);

        String testCase = "openJDK";

        switch (testCase) {
            case "yummy": {
                System.out.println("Yummy");
                break;
            }
            case "meloncholy": {
                System.out.println("Sad");
                break;
            }
            case "openJDK": {
                System.out.print("The future of Java...");
            }
            case "jdk7":
                System.out.print(" today.\n");
        }

        File f = new File(System.getProperty("user.home"));
        Path p = f.toPath();
        System.out.println("Current Path: " + p.toString());

        Integer[] assorted = new Integer[5000];
        Random generator = new Random();

        for (int i = 0; i < 5000; i++) {
            assorted[i] = generator.nextInt(1_000_000);
        }
        System.out.println("\n\n\n\n\nunsorted: " + Arrays.toString(assorted) + "\n\n\n\n\n");

        ParallelMergeSort.sort(assorted);

        System.out.println("sorted: " + Arrays.toString(assorted));

    }
}
Enhanced by Zemanta

Thursday, September 30, 2010

JavaOne 2010: JDK7 Milestones

It has been a week since JavaOne. I am on the OpenJDK site looking at the plans for JDK7, and it is still empty with no updated plans. Only an orange text box promising an update to the milestones.

There were enough repetitive presentations, and probably discussions behind the scenes prior to JavaOne. Where is the plan? You can check it out yourself at the link below.

JDK7 Milestones

Enhanced by Zemanta

Saturday, July 31, 2010

OpenJDK 7 64-bit Mac

I updated the Darwin10Build instructions for building the BSD port of OpenJDK 7 on the OpenJDK wiki at Oracle. I successfully built 32-bit binaries, but decided to see if I could get it to build 64-bit binaries by changing the ARCH_DATA_MODEL=64 parameter to the build script. It worked. It reports that the build is amd64, but it is running on a MacBook Pro Intel Core Duo system. I added my 64-bit build script to the Darwin10Build instructions. Here is an image of my 64-bit build running tomcat. You can see the build is listed 1.7.0-internal-jyeary, and the OS Architecture amd64.


Enhanced by Zemanta

Popular Posts