Oracle & Apple Announce OpenJDK Project For OSX
Posted by tech on
December 15, 2010
Good news all around! Oracle and Apple announced the OpenJDK project for Mac OS X. Apple will contribute most of the key components, tools and technology required for a Java SE 7 implementation on Mac OS X, including a 32-bit and 64-bit HotSpot-based Java virtual machine, class libraries, a networking stack and the foundation for a new graphical client.
OpenJDK will make Apple’s Java technology available to open source developers so you can access and contribute to the effort.
Furthermore, the JCP Executive Committe has approved the JSR “quartet” for Java SE 7 and Java SE 8. With this ratification, the Java standard will progress through the JCP while the open source reference implementation will be delivered through the OpenJDK project.
Found this post useful? Donations appreciated. Every little $ helps.tags: apple, java, Java Virtual Machine, mac, mac osx, openjdk, oracle, osx
No Comments
Capitalize First Letter Of Every Sentence In Java Without Using Regex
Posted by tech on
December 2, 2010
Here is a method I found in the Internet made by a certain Dogstopper of dream.in.code where every first letter of a sentence is capitalized using Java. I have my own but it uses Regex so I decided to post this one here for future reference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | public static String capitalizeFirstLetterOfEachSentence(String str){ char[] arr = str.toCharArray(); // Start off by indicating to capitalize the first letter. boolean cap = true; boolean space_found = true; for (int i = 0; i<arr.length; i++){ if (cap) { // white space includes \n, space if (Character.isWhitespace(arr[i])) space_found = true; else { if (space_found && !Character.isUpperCase(arr[i])) arr[i] = Character.toUpperCase(arr[i]); cap = false; space_found = false; } } else { if (arr[i] == '.' || arr[i] == '?' || arr[i] == '!') { cap = true; } } } return new String(arr); } |
tags: capitalize, java, regex, sentence
2 Comments
Detect If Windows User Has Admin Rights Using Java
Posted by tech on
October 21, 2010
While at first glance, Java people may think of using Java Authentication and Authorization Service (JAAS) as the solution to access a Windows user’s rights if one is part of the Administrator group or not, there is actually a Sun implementation of JAAS in Java’s library jar “rt.jar” with a package name of com.sun.security.auth.
The class is called NTSystem and the method below returns true if the user logged in to the Windows workstation has admin rights or none.
1 2 3 4 5 6 7 8 | public static boolean isAdmin() { String groups[] = (new com.sun.security.auth.module.NTSystem()).getGroupIDs(); for (String group : groups) { if (group.equals("S-1-5-32-544")) return true; } return false; } |
The SID S-1-5-32-544 is the id of the Administrator group in the Windows operating system.
Found this post useful? Donations appreciated. Every little $ helps.









