2014年3月18日、甲骨文的Java开发团队发布Java 8正式版本。
[b]Windows XP下的安装[/b]
从官网网站下载jdk-8-windows-i586.exe
[url=http://www.oracle.com/technetwork/java/javase/downloads/index.html]http://www.oracle.com/technetwork/java/javase/downloads/index.html[/url]
运行jdk-8-windows-i586.exe
[quote]the procedure entry point RegDeleteKeyExA could not be located in the dynamic link library advapi32.dll[/quote]
这是因为安装程序调用了Windows Vista以后版本的API函数。
2014年4月8日起,微软将停止对Windows XP的支持,所以JDK8也将不再支持Windows XP系统,不过还好这只是安装程序的问题。我们通过解压安装的方式,还是能够在Windows XP系统上安装JDK8的。
[b]安装方法[/b]
(1)使用7-Zip解压jdk-8-windows-i586.exe文件后会取出来一个zip文件
[quote]tools.zip[/quote]
(2)再解压tools.zip到D:\java\jdk1.8.0
[quote]D:\java\jdk1.8.0
+-- bin
+-- db
+-- include
+-- jre
+-- lib
+-- javafx-src.zip
+-- LICENSE
+-- README.html
+-- release
+-- THIRDPARTYLICENSEREADME.txt
+-- THIRDPARTYLICENSEREADME-JAVAFX.txt[/quote]
(3)解压后的JDK文件夹(jre/lib)中,没有rt.jar和tools.jar,而是rt.pack、tools.pack这两个文件。需要使用JDK的pack200工具来把pack文件解压成jar文件。
[quote]D:\java\jdk1.8.0> FOR /R %f IN (*.pack) DO "D:\java\jdk1.8.0\bin\unpack200.exe" -r -v "%f" "%~pf%~nf.jar"[/quote]
(4)确认JDK版本
[quote]D:\java\jdk1.8.0\bin>java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)[/quote]
(5)测试
Lambda.java
把Lambda.java拷贝到D:\java\jdk1.8.0\bin下:
[img]http://dl2.iteye.com/upload/attachment/0095/0706/011194bf-8ecc-3a3f-9cb9-28c1d0c98cf5.png[/img]
这样 JDK8 就在Windows XP下安装成功了。
[b]Eclipse中使用Java 8[/b]
①从官网[url=http://www.eclipse.org/downloads/]http://www.eclipse.org/downloads/[/url]下载Eclipse Kepler 4.3.2。
②启动Eclipse后,在Window -> Preferences的Java -> Insatalled JREs中设置JRE为jdk8。
③默认Window -> Preferences的Java -> Compiler中Compiler compliance level不能选择1.8。需要通过Help -> Install New Software 在 'Work with' 中输入 [url=http://download.eclipse.org/eclipse/updates/4.3-P-builds/]http://download.eclipse.org/eclipse/updates/4.3-P-builds/[/url] 后选择'Eclipse Java 8 Support'安装。
安装成功后重启Eclipse,Compiler中Compiler compliance level就可以选择“1.8”了。
Eclipse 4.4 Luna开始支持Java 8,目前还处于开发中,预计2014年6月发布。不过现在可以下载 [url=http://download.eclipse.org/eclipse/downloads/drops4/I20140318-0830/]Eclipse 4.4 build I20140318-0830[/url] 版本。
[url=http://eclipsesource.com/blogs/2014/03/25/eclipse-support-for-java-8/]Eclipse Support for Java 8[/url]
[b]快速把匿名内部类转化为lambda表达式:[/b]
[img]http://dl2.iteye.com/upload/attachment/0095/3351/4413436a-70a8-3a34-b968-be5601928404.png[/img]
[b]反射修改参数名:[/b]
[img]http://dl2.iteye.com/upload/attachment/0095/3353/c2a7618b-2150-3c38-8670-e778e9215882.png[/img]
[b]调试:[/b]
[img]http://dl2.iteye.com/upload/attachment/0095/3355/1b27d48a-baca-33e4-acbc-c54780f95820.png[/img]
[b]Java Version History[/b]
[url=http://en.wikipedia.org/wiki/Java_version_history]http://en.wikipedia.org/wiki/Java_version_history[/url]
[table]
|Version Name|Release Date|Code Name|
|Java 1.0|1996/01/23|Oak|
|Java 1.1|1997/02/19|(none)|
|Java 1.2|1998/12/08|Playground|
|Java 1.3|2000/05/08|Kestrel|
|Java 1.4|2002/02/06|Merlin|
|Java 5|2004/09/30|Tiger|
|Java 6|2006/12/11|Mustang|
|Java 7|2011/07/28|Dolphin|
|Java 8|2014/03/18|(none)|
[/table]
[b]Java New Features[/b]
JDK 5
[url=http://docs.oracle.com/javase/1.5.0/docs/relnotes/features.html]http://docs.oracle.com/javase/1.5.0/docs/relnotes/features.html[/url]
JDK 6
[url=http://www.oracle.com/technetwork/java/javase/features-141434.html]http://www.oracle.com/technetwork/java/javase/features-141434.html[/url]
JDK 7
[url=http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html]http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html[/url]
[url=http://openjdk.java.net/projects/jdk7/features/]http://openjdk.java.net/projects/jdk7/features/[/url]
JDK 8
[url=http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html]http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html[/url]
[url=http://openjdk.java.net/projects/jdk8/features/]http://openjdk.java.net/projects/jdk8/features/[/url]
[b]New Core Features in Java 8[/b]
为了能适应当前大数据/多核/云计算的环境,让Java也能像Scala/C#等语言一样更加现代化,Java 8 开始提供了如:Lambda(Method references、Functional Interfaces)、Default Methods、Streams、Date/Time等特性。
可以参考以下URL:
[url=http://slidedeck.io/DDuarte/java8-slides]http://slidedeck.io/DDuarte/java8-slides[/url]
[url=http://www.coreservlets.com/java-8-tutorial/]http://www.coreservlets.com/java-8-tutorial/[/url]
[url=http://winterbe.com/posts/2014/03/16/java-8-tutorial/]http://winterbe.com/posts/2014/03/16/java-8-tutorial/[/url]
[url=https://leanpub.com/whatsnewinjava8/read]https://leanpub.com/whatsnewinjava8/read[/url]
[url=https://speakerdeck.com/buzdin/java-8-language-additions]https://speakerdeck.com/buzdin/java-8-language-additions[/url]
[url=http://www.baeldung.com/java8]http://www.baeldung.com/java8[/url]
[url=http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-July/009005.html]http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-July/009005.html[/url]
[url=http://stackoverflow.com/questions/20965564/installing-jdk8-on-windows-xp-advapi32-dll-error]http://stackoverflow.com/questions/20965564/installing-jdk8-on-windows-xp-advapi32-dll-error[/url]
[url=https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler]https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler[/url]
[b]Windows XP下的安装[/b]
从官网网站下载jdk-8-windows-i586.exe
[url=http://www.oracle.com/technetwork/java/javase/downloads/index.html]http://www.oracle.com/technetwork/java/javase/downloads/index.html[/url]
运行jdk-8-windows-i586.exe
[quote]the procedure entry point RegDeleteKeyExA could not be located in the dynamic link library advapi32.dll[/quote]
这是因为安装程序调用了Windows Vista以后版本的API函数。
2014年4月8日起,微软将停止对Windows XP的支持,所以JDK8也将不再支持Windows XP系统,不过还好这只是安装程序的问题。我们通过解压安装的方式,还是能够在Windows XP系统上安装JDK8的。
[b]安装方法[/b]
(1)使用7-Zip解压jdk-8-windows-i586.exe文件后会取出来一个zip文件
[quote]tools.zip[/quote]
(2)再解压tools.zip到D:\java\jdk1.8.0
[quote]D:\java\jdk1.8.0
+-- bin
+-- db
+-- include
+-- jre
+-- lib
+-- javafx-src.zip
+-- LICENSE
+-- README.html
+-- release
+-- THIRDPARTYLICENSEREADME.txt
+-- THIRDPARTYLICENSEREADME-JAVAFX.txt[/quote]
(3)解压后的JDK文件夹(jre/lib)中,没有rt.jar和tools.jar,而是rt.pack、tools.pack这两个文件。需要使用JDK的pack200工具来把pack文件解压成jar文件。
[quote]D:\java\jdk1.8.0> FOR /R %f IN (*.pack) DO "D:\java\jdk1.8.0\bin\unpack200.exe" -r -v "%f" "%~pf%~nf.jar"[/quote]
(4)确认JDK版本
[quote]D:\java\jdk1.8.0\bin>java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)[/quote]
(5)测试
Lambda.java
import java.util.Arrays;
import java.util.List;
public class Lambda {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
list.forEach(n -> System.out.println(n));
}
}
把Lambda.java拷贝到D:\java\jdk1.8.0\bin下:
[img]http://dl2.iteye.com/upload/attachment/0095/0706/011194bf-8ecc-3a3f-9cb9-28c1d0c98cf5.png[/img]
这样 JDK8 就在Windows XP下安装成功了。
[b]Eclipse中使用Java 8[/b]
①从官网[url=http://www.eclipse.org/downloads/]http://www.eclipse.org/downloads/[/url]下载Eclipse Kepler 4.3.2。
②启动Eclipse后,在Window -> Preferences的Java -> Insatalled JREs中设置JRE为jdk8。
③默认Window -> Preferences的Java -> Compiler中Compiler compliance level不能选择1.8。需要通过Help -> Install New Software 在 'Work with' 中输入 [url=http://download.eclipse.org/eclipse/updates/4.3-P-builds/]http://download.eclipse.org/eclipse/updates/4.3-P-builds/[/url] 后选择'Eclipse Java 8 Support'安装。
安装成功后重启Eclipse,Compiler中Compiler compliance level就可以选择“1.8”了。
Eclipse 4.4 Luna开始支持Java 8,目前还处于开发中,预计2014年6月发布。不过现在可以下载 [url=http://download.eclipse.org/eclipse/downloads/drops4/I20140318-0830/]Eclipse 4.4 build I20140318-0830[/url] 版本。
[url=http://eclipsesource.com/blogs/2014/03/25/eclipse-support-for-java-8/]Eclipse Support for Java 8[/url]
[b]快速把匿名内部类转化为lambda表达式:[/b]
[img]http://dl2.iteye.com/upload/attachment/0095/3351/4413436a-70a8-3a34-b968-be5601928404.png[/img]
[b]反射修改参数名:[/b]
[img]http://dl2.iteye.com/upload/attachment/0095/3353/c2a7618b-2150-3c38-8670-e778e9215882.png[/img]
[b]调试:[/b]
[img]http://dl2.iteye.com/upload/attachment/0095/3355/1b27d48a-baca-33e4-acbc-c54780f95820.png[/img]
[b]Java Version History[/b]
[url=http://en.wikipedia.org/wiki/Java_version_history]http://en.wikipedia.org/wiki/Java_version_history[/url]
[table]
|Version Name|Release Date|Code Name|
|Java 1.0|1996/01/23|Oak|
|Java 1.1|1997/02/19|(none)|
|Java 1.2|1998/12/08|Playground|
|Java 1.3|2000/05/08|Kestrel|
|Java 1.4|2002/02/06|Merlin|
|Java 5|2004/09/30|Tiger|
|Java 6|2006/12/11|Mustang|
|Java 7|2011/07/28|Dolphin|
|Java 8|2014/03/18|(none)|
[/table]
[b]Java New Features[/b]
JDK 5
[url=http://docs.oracle.com/javase/1.5.0/docs/relnotes/features.html]http://docs.oracle.com/javase/1.5.0/docs/relnotes/features.html[/url]
JDK 6
[url=http://www.oracle.com/technetwork/java/javase/features-141434.html]http://www.oracle.com/technetwork/java/javase/features-141434.html[/url]
JDK 7
[url=http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html]http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html[/url]
[url=http://openjdk.java.net/projects/jdk7/features/]http://openjdk.java.net/projects/jdk7/features/[/url]
JDK 8
[url=http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html]http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html[/url]
[url=http://openjdk.java.net/projects/jdk8/features/]http://openjdk.java.net/projects/jdk8/features/[/url]
[b]New Core Features in Java 8[/b]
为了能适应当前大数据/多核/云计算的环境,让Java也能像Scala/C#等语言一样更加现代化,Java 8 开始提供了如:Lambda(Method references、Functional Interfaces)、Default Methods、Streams、Date/Time等特性。
可以参考以下URL:
[url=http://slidedeck.io/DDuarte/java8-slides]http://slidedeck.io/DDuarte/java8-slides[/url]
[url=http://www.coreservlets.com/java-8-tutorial/]http://www.coreservlets.com/java-8-tutorial/[/url]
[url=http://winterbe.com/posts/2014/03/16/java-8-tutorial/]http://winterbe.com/posts/2014/03/16/java-8-tutorial/[/url]
[url=https://leanpub.com/whatsnewinjava8/read]https://leanpub.com/whatsnewinjava8/read[/url]
[url=https://speakerdeck.com/buzdin/java-8-language-additions]https://speakerdeck.com/buzdin/java-8-language-additions[/url]
[url=http://www.baeldung.com/java8]http://www.baeldung.com/java8[/url]
[url=http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-July/009005.html]http://mail.openjdk.java.net/pipermail/openjfx-dev/2013-July/009005.html[/url]
[url=http://stackoverflow.com/questions/20965564/installing-jdk8-on-windows-xp-advapi32-dll-error]http://stackoverflow.com/questions/20965564/installing-jdk8-on-windows-xp-advapi32-dll-error[/url]
[url=https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler]https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler[/url]