├── .gitignore ├── README.md ├── java10 ├── CONTRIBUTING.md ├── JEP_286_Local-Variable_Type_Inference │ ├── 01_Primitive_Data_Types │ │ ├── README.md │ │ └── src │ │ │ └── com │ │ │ └── typeinference │ │ │ └── PrimitiveTypes.java │ ├── 02_Object_Data_Types │ │ ├── README.md │ │ └── src │ │ │ └── com │ │ │ └── typeinference │ │ │ ├── Book.java │ │ │ ├── ObjectTypes.java │ │ │ └── Store.java │ ├── 03_Arrays_Data_Types │ │ ├── README.md │ │ └── src │ │ │ └── com │ │ │ └── typeinference │ │ │ ├── ArraysTypes.java │ │ │ └── Hero.java │ ├── 04_Full_uses │ │ ├── README.md │ │ └── src │ │ │ └── com │ │ │ └── typeinference │ │ │ └── Java10var.java │ ├── 05_JShell │ │ └── README.md │ └── 06_More_Exercises │ │ ├── AnonymousInnerClass.java │ │ ├── EnhancedForLoop.java │ │ ├── LambdaExpressions.java │ │ ├── LocalVariable.java │ │ ├── PrimitivesAndBigDecimal.java │ │ ├── README.md │ │ ├── ReservedKeyword.java │ │ ├── RestrictedUse.java │ │ ├── WithCollections.java │ │ ├── WithInterface.java │ │ └── WithStreams.java ├── JEP_313_Remove_the_Native-Header_Generation_Tool_(javah) │ ├── NativeTest.java │ └── README.md ├── JEP_314_Additional_Unicode_Language-Tag_Extensions │ └── README.md ├── JEP_319_Root_Certificates │ └── README.md ├── Java-10-Resources.md ├── README.md ├── common-functions.sh ├── common.sh ├── getJDK10.sh ├── setupAndVerifyJDK.md ├── setupEclipseOxygen.md └── setupTreeAndWget.md └── java11 └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | #IDE settings 2 | .idea 3 | .settings 4 | .project 5 | .* 6 | *.iml 7 | 8 | !.gitignore 9 | 10 | ### Java template 11 | *.class 12 | 13 | !/lib/oauth.net.jar 14 | 15 | # Package Files # 16 | *.jar 17 | *.war 18 | *.ear 19 | *.zip 20 | *.tar.gz 21 | *.jimage 22 | *.jmod 23 | target/ 24 | 25 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 26 | hs_err_pid* 27 | 28 | # Created by .ignore support plugin (hsz.mobi) 29 | 30 | # Do include library jars 31 | !**/lib/*.jar 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java 10 2 | 3 | - [Java 10 Features](java10/README.md) 4 | - [Java 10 Resources](java10/Java-10-Resources.md) 5 | 6 | # Java 11 7 | 8 | Java 11 features 9 | -------------------------------------------------------------------------------- /java10/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution Guidelines 2 | 3 | _Exercises / examples_ 4 | 5 | Please add as many exercises and examples to this repo, the `master` branch is the place to put your exercises that need to be solved. Or examples that have comments on what it is doing, or how to use a JDK10 features or how it has been used across the whole project. Have a look at how we have already created some of the exercises. 6 | If you know of a feature or cool trick in JDK 10, then this is the place to put it. 7 | 8 | ##### Testing 9 | 10 | Test your work under the respective platforms i.e. Linux, Mac and Windows, if not, please specify in your pull request which platforms need testing and what to do. 11 | 12 | ##### Platform coverage 13 | 14 | Try to always provide exercises / examples / solutions for all three platforms, otherwise please let us know the platforms which are not covered. 15 | 16 | #### Pull Requests 17 | 18 | Ensure solutions to exercises are placed in the `exercise-solutions` branch. Typically examples can be (and should) be placed in both `master` and `exercise-solutions` branches. 19 | 20 | We also have branches called `ant-version`, and `maven-branch` which is a near-literal translation of the exercises in the `master` branch into the respective build systems. 21 | 22 | _[Java 10 Resources file](https://github.com/AdoptOpenJDK/java-10-and-beyond/blob/master/Java-10-Resources.md)_ 23 | 24 | At the moment there isn't a lot written or spoken about this subject but nevertheless we would like consider links that are useful for the wider community, so we think the below would help: 25 | 26 | (a) widely recommended, regardless of personal opinion 27 | 28 | (b) discussed in the community (mentioned via social media) 29 | 30 | (c) a good starting point for the subject or related subjects (contains examples) 31 | 32 | (d) implementations that would be a good example for everyone to follow and be inspired by 33 | 34 | 35 | #### Pull Requests 36 | 37 | There are two required criteria for a pull request: 38 | 39 | 1. If an entry has a similar scope as other entries in the same category, the description must state the unique features that distinguishes it from the other entries. 40 | 41 | 2. If an entry does not meet conditions *(a)* to *(d)* there has to be an explanation either in the description or the pull request why it should be added to the list. 42 | 43 | Self-promotion is not encouraged, but your suggestion will of course be approved if the criteria match. 44 | 45 | Furthermore, please ensure your pull request follows the following guidelines: 46 | 47 | * Please search previous suggestions before making a new one, as yours may be a duplicate 48 | * Please make an individual pull request for each suggestion 49 | * Use the format that exists in the [Java 10 Resources file](https://github.com/AdoptOpenJDK/java-10-and-beyond/blob/master/Java-10-Resources.md) file, at the moment 50 | * New categories or improvements to the existing categorization are welcome 51 | * Check your spelling and grammar 52 | * Make sure your text editor is set to remove trailing whitespace 53 | 54 | Thank you for your suggestions! 55 | 56 | #### License 57 | 58 | See [License](LICENSE) document to find out about the licensing terms and conditions. 59 | 60 | #### Social media 61 | 62 | Please share this repo with everyone in your social network, dev. communities and local user groups. 63 | 64 | Some of the actions to do when you have landed here: 65 | - [Watch the project](https://github.com/AdoptOpenJDK/jdk10-and-beyond/subscription) 66 | - [Stargazers of the project](https://github.com/AdoptOpenJDK/jdk10-and-beyond/stargazers) 67 | - [Fork the project](https://github.com/AdoptOpenJDK/jdk10-and-beyond/graphs/contributors#fork-destination-box) 68 | - [Checkout the project activity radiator](https://github.com/AdoptOpenJDK/jdk10-and-beyond/pulse) 69 | - [Stats and graphs on our star contributors](https://github.com/AdoptOpenJDK/jdk10-and-beyond/graphs/contributors) 70 | 71 | **Let this repo be a brain-dump of every way to do things in JDK 10** 72 | 73 | --- 74 | 75 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/01_Primitive_Data_Types/README.md: -------------------------------------------------------------------------------- 1 | **Local Variable Type Inference for Primitive Data Types example** 2 | 3 | This first example is a class named `PrimitiveTypes` whose methods should use 4 | `Type Inference` to declare variables using them in Expressions, Statements, and Blocks as Loops. 5 | 6 | Perform the below commands to see the contents of the respective Java classes contained in the src folder: 7 | 8 | $ cat src/com/typeinference/PrimitiveTypes.java 9 | 10 | Compile the example with the following command: 11 | 12 | $ javac -d target src/com/typeinference/PrimitiveTypes.java 13 | 14 | And we run the example with the following command: 15 | 16 | $ java -cp target com/typeinference/PrimitiveTypes 17 | 18 | Now, open the file `com/typeinference/PrimitiveTypes.java` and replace all primitive data types declaration with 19 | the new keyword `var`, this change allows you to use Variable Type Inference. 20 | 21 | int id --> var id 22 | 23 | Once you have replaced all primitive data types declaration, execute the commands for compile and run. Please compare the outputs, are they the same? 24 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/01_Primitive_Data_Types/src/com/typeinference/PrimitiveTypes.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | public class PrimitiveTypes { 4 | 5 | public static void main(String[] args) { 6 | 7 | int years = 37; // this primitive var declaration should be changed 8 | char gender = 'M'; // this primitive var declaration should be changed 9 | 10 | if ( gender == 'M' ) { 11 | System.out.println( "Hi Mister, you're " + years + " old " ); 12 | } 13 | else if ( gender == 'F' ) { 14 | System.out.println( "Hi Miss, you're " + years + " old " ); 15 | } 16 | else { 17 | System.out.println( "Hi, you're " + years + " old " ); 18 | } 19 | 20 | double totalPayment = 6200; // this primitive var declaration should be changed, it might be necessary to make a little change 21 | int days = 85; // this primitive var declaration should be changed 22 | 23 | double value = totalPayment / days; // this primitive var declaration should be changed 24 | 25 | System.out.println( "Last month you earned $ " + value + " per day " ); 26 | 27 | for ( int i = 0; i < 10; i++ ) { 28 | 29 | boolean isEven = i % 2 == 0; 30 | 31 | if ( isEven ) { 32 | System.out.println( i + " is an even number " ); 33 | } 34 | else { 35 | System.out.println( i + " is an odd number " ); 36 | } 37 | 38 | } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/02_Object_Data_Types/README.md: -------------------------------------------------------------------------------- 1 | **Local Variable Type Inference for Object Data Types example** 2 | 3 | This example is a class named `ObjectTypes` whose methods should use 4 | `Type Inference` to declare variables using them in Expressions, Statements, and Blocks as Loops. 5 | 6 | Perform the below commands to see the contents of the respective Java classes contained in the src folder: 7 | 8 | $ cat src/com/typeinference/ObjectTypes.java 9 | 10 | Compile the example with the following command: 11 | 12 | $ javac -d target src/com/typeinference/* 13 | 14 | And we run the example with the following command: 15 | 16 | $ java -cp target com/typeinference/ObjectTypes 17 | 18 | Now, open the file `com/typeinference/ObjectTypes.java` and replace all object data types declaration with 19 | the new keyword `var`, this change allows you to use Variable Type Inference. 20 | 21 | String id --> var id 22 | Book theLordOfTheRings --> var theLordOfTheRings 23 | 24 | **Note:** The class `ObjectTypes.java` class uses objecs defined by the user `(Book, Store)` and by the JDK `(String, Integer, List )` 25 | 26 | Once you have replaced all object data types declaration, execute the commands for compile and run. Please compare the outputs, are they the same? 27 | Are the types an instance of some object? 28 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/02_Object_Data_Types/src/com/typeinference/Book.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | public class Book { 4 | 5 | private String name; 6 | private Double price; 7 | 8 | public Book(String name, Double price) { 9 | this.name = name; 10 | this.price = price; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "Book{" + 16 | "name='" + name + '\'' + 17 | ", price=" + price + 18 | '}'; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/02_Object_Data_Types/src/com/typeinference/ObjectTypes.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | public class ObjectTypes { 7 | 8 | public static void main(String[] args) { 9 | 10 | Integer years = 37; // this object var declaration should be changed 11 | String gender = "FEMALE"; // this object var declaration should be changed 12 | 13 | if ( gender.equals( "MALE" ) ) { 14 | System.out.println( "Hi Mister, you're " + years + " old " ); 15 | } 16 | else if ( gender.equals( "FEMALE" ) ) { 17 | System.out.println( "Hi Miss, you're " + years + " old " ); 18 | } 19 | else { 20 | System.out.println( "Hi, you're " + years + " old " ); 21 | } 22 | 23 | Double totalPayment = 6200D; // this object var declaration should be changed, it might be necessary to make a little change 24 | Long days = 85L; // this object var declaration should be changed, it might be necessary a little trick 25 | 26 | Double value = totalPayment / days; // this object var declaration should be changed 27 | 28 | System.out.println( "Last month you earned $ " + value + " per day " ); 29 | 30 | Book theLordOfTheRings = new Book("The Lord Of The Rings", 19.99); 31 | Store centralPark = new Store( "Central Park"); 32 | 33 | System.out.println( "Your favorite book " + theLordOfTheRings + ", is available in our store " + centralPark.getName() ); 34 | 35 | 36 | List animalss = Arrays.asList( "DOG", "CAT", "MOUSE"); 37 | System.out.println(animalss); 38 | 39 | //Checking objects' class 40 | System.out.println( " " ); 41 | System.out.println( "totalPayment is an instance of " + totalPayment.getClass() ); 42 | System.out.println( "days is an instance of " + days.getClass() ); 43 | System.out.println( "value is an instance of " + value.getClass() ); 44 | System.out.println( "theLordOfTheRings is an instance of " + theLordOfTheRings.getClass() ); 45 | System.out.println( "centralPark is an instance of " + centralPark.getClass() ); 46 | System.out.println( "animalss is an instance of " + animalss.getClass() ); 47 | } 48 | } -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/02_Object_Data_Types/src/com/typeinference/Store.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | public class Store { 4 | 5 | private String name; 6 | 7 | public Store(String name) { 8 | this.name = name; 9 | } 10 | 11 | public String getName() { 12 | return name; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/03_Arrays_Data_Types/README.md: -------------------------------------------------------------------------------- 1 | **Local Variable Type Inference for Arrays Data Types example** 2 | 3 | This example is a class named `ArraysTypes` whose methods should use 4 | `Type Inference` to declare variables using them in Expressions, Statements, and Blocks as Loops. 5 | 6 | Perform the below commands to see the contents of the respective Java classes contained in the src folder: 7 | 8 | $ cat src/com/typeinference/ArraysTypes.java 9 | 10 | Compile the example with the following command: 11 | 12 | $ javac -d target src/com/typeinference/* 13 | 14 | And we run the example with the following command: 15 | 16 | $ java -cp target com/typeinference/ArraysTypes 17 | 18 | Now, open the file `com/typeinference/ArraysTypes.java` and replace all array data types declaration with 19 | the new keyword `var`, this change allows you to use Variable Type Inference. 20 | 21 | int[] myArray --> var myArray 22 | 23 | Once you have replaced all array data types declaration, execute the commands for compile and run. 24 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/03_Arrays_Data_Types/src/com/typeinference/ArraysTypes.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | import java.util.Random; 4 | 5 | public class ArraysTypes { 6 | 7 | public static void main(String[] args) { 8 | String[] animalss = new String[3]; 9 | 10 | animalss[0] = "DOG"; 11 | animalss[1] = "CAT"; 12 | animalss[2] = "MOUSE"; 13 | 14 | for ( String animal : animalss ) { 15 | System.out.println( animal ); 16 | } 17 | 18 | String[][] names = new String[][] { 19 | { "Mr. ", "Mrs. ", "Ms. " }, 20 | { "Bean", "Krabappel" } 21 | }; 22 | // Mr. Bean 23 | String mrBean = names[0][0] + names[1][0]; 24 | System.out.println( mrBean ); 25 | 26 | // Ms. 27 | String msKrabappel = names[0][2] + names[1][1]; 28 | System.out.println( names[0][2] + names[1][1] ); 29 | 30 | Hero[] heroes = new Hero[]{ 31 | new Hero( "Spiderman" ), 32 | new Hero( "Batman" ), 33 | new Hero( "American Captain" ), 34 | new Hero( "Deadpool" ), 35 | new Hero( "Iron Man" ), 36 | new Hero( "Luke Skywalker" ), 37 | new Hero( "Black Panther" ), 38 | new Hero( "Superman" ), 39 | new Hero( "Wonder Woman" ), 40 | new Hero( "Duke" ), 41 | }; 42 | 43 | Random rand = new Random( ); 44 | Hero bestHero = heroes[rand.nextInt( 9 )]; 45 | 46 | System.out.println("and the best hero is ... "); 47 | System.out.println(bestHero.getName() ); 48 | 49 | 50 | //Checking objects' class 51 | System.out.println( " " ); 52 | System.out.println( "animalss is an instance of " + animalss.getClass() ); 53 | System.out.println( "names is an instance of " + names.getClass() ); 54 | System.out.println( "mrBean is an instance of " + mrBean.getClass() ); 55 | System.out.println( "msKrabappel is an instance of " + msKrabappel.getClass() ); 56 | System.out.println( "heroes is an instance of " + heroes.getClass() ); 57 | System.out.println( "bestHero is an instance of " + bestHero.getClass() ); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/03_Arrays_Data_Types/src/com/typeinference/Hero.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | public class Hero { 4 | private String name; 5 | 6 | public Hero(String name) { 7 | this.name = name; 8 | } 9 | 10 | public String getName() { 11 | return name; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/04_Full_uses/README.md: -------------------------------------------------------------------------------- 1 | **Local Variable Type Inference for all Types example** 2 | 3 | This example is a class named `Java10var` whose methods should use 4 | `Type Inference` to declare variables using them in Expressions, Statements, and Blocks as Loops. 5 | 6 | Perform the below commands to see the contents of the respective Java classes contained in the src folder: 7 | 8 | $ cat src/com/typeinference/Java10var.java 9 | 10 | Compile the example with the following command: 11 | 12 | $ javac -d target src/com/typeinference/Java10var.java 13 | 14 | And we run the example with the following command: 15 | 16 | $ java -cp target com/typeinference/Java10var 17 | 18 | Now, open the file `com/typeinference/Java10var.java` and replace all data types declaration with 19 | the new keyword `var`, this change allows you to use Variable Type Inference. 20 | 21 | int id --> var id 22 | Integer myNumber --> var myNumber 23 | 24 | Once you have replaced all primitive data types declaration, execute next command for compile the example: 25 | 26 | $ javac -d target src/com/typeinference/Java10var.java 27 | 28 | ** Note:** The `Java10var` class has some variable declarations with Variable Type Inference that can not be used. 29 | Open the file `com/typeinference/Java10var.java` identify the uses of Variable Type Inference that are not allowed and change them for the original declaration. 30 | 31 | Once you example compiles, execute it with the following command: 32 | 33 | $ java -cp target com/typeinference/Java10var 34 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/04_Full_uses/src/com/typeinference/Java10var.java: -------------------------------------------------------------------------------- 1 | package com.typeinference; 2 | 3 | import java.time.LocalDate; 4 | import java.time.LocalDateTime; 5 | import java.time.Month; 6 | import java.time.ZoneId; 7 | import java.util.ArrayList; 8 | import java.util.HashMap; 9 | import java.util.LinkedList; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /* 14 | * This class has some variable declarations that can't be changed for Java 10 type inference way, 15 | * you should try to change whichever you think can use var, and then compile to check if your changes are correct 16 | * */ 17 | public class Java10var { 18 | 19 | public ZoneId zoneIdAraucaColombia = ZoneId.of( "GMT-5" ); 20 | public ZoneId zoneIdIstanbulTurkey = ZoneId.of( "GMT+3" ); 21 | public ZoneId zoneIdLondonUK = ZoneId.of( "GMT+1" ); 22 | 23 | public static void main(String args[]) { 24 | 25 | Java10var java10var = new Java10var(); 26 | List numberss = List.of( 13L, 11L, 12L, 13L, 10L, 15L, 12L, 11L, 10L ); 27 | 28 | Double average = java10var.average( numberss ); 29 | System.out.println( "Average is: " + average ); 30 | 31 | Long first = java10var.getFirst( numberss ); 32 | System.out.println( "The first number in the list is: " + first ); 33 | 34 | java10var.printTimes(); 35 | 36 | printMonth(); 37 | 38 | printNumbers(); 39 | } 40 | 41 | public Double average(List numberss) { 42 | Double average = 0D; 43 | Double sum = numberss.stream().mapToDouble( p -> p ).sum(); 44 | average = sum / numberss.size(); 45 | return average; 46 | } 47 | 48 | public Long getFirst(List numberss) { 49 | Long first; 50 | first = numberss.get( 0 ); 51 | return first; 52 | } 53 | 54 | public void printTimes() { 55 | LocalDateTime localDateTimeAraucaColombia = LocalDateTime.now( zoneIdAraucaColombia ); 56 | LocalDateTime localDateTimeIstanbulTurkey = LocalDateTime.now( zoneIdIstanbulTurkey ); 57 | LocalDateTime localDateTimeLondoUK = LocalDateTime.now( zoneIdLondonUK ); 58 | 59 | System.out.println( "Current time in Arauca - Colombia is: " + localDateTimeAraucaColombia ); 60 | System.out.println( "Current time in Istanbul - Turkey is: " + localDateTimeIstanbulTurkey ); 61 | System.out.println( "Current time in London - United Kingdom is: " + localDateTimeLondoUK ); 62 | } 63 | 64 | public static void printMonth() { 65 | int monthValue = LocalDate.now().getMonthValue(); 66 | String monthName; 67 | 68 | Map months = new HashMap<>(); 69 | for(Month month:Month.values()){ 70 | months.put( month.getValue(), month.name() ); 71 | } 72 | 73 | monthName = months.get( monthValue ); 74 | 75 | System.out.println( "monthName: " + monthName ); 76 | } 77 | 78 | public static void printNumbers() { 79 | List myList = new ArrayList<>(); 80 | myList.addAll( List.of("ONE","TWO","THREE","FIVE","SEVEN", "ELEVEN", "THIRTEEN", "SEVENTEEN" ) ); 81 | 82 | System.out.println( myList ); 83 | 84 | myList = new LinkedList<>(); 85 | myList.addAll( List.of("1" , "2" , "3" , "5" , "7" , "11" , "13" , "17" )); 86 | 87 | System.out.println( myList ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/05_JShell/README.md: -------------------------------------------------------------------------------- 1 | **JShell: Local Variable Type Inference for all Types example** 2 | 3 | This example covers the use of `Type Inference` in JShell to declare variables using them in Expressions, Statements, and Blocks as Loops. 4 | 5 | You can run this example on your local JShell or online. For more information about JShell you can go to: https://github.com/AdoptOpenJDK/jdk9-jigsaw/tree/master/session-3-jshell 6 | 7 | To execute Local JShell run next command 8 | 9 | jshell 10 | 11 | Verify you are using JShell for Java 10 version 12 | 13 | | Welcome to JShell -- Version 10 14 | | For an introduction type: /help intro 15 | 16 | 17 | To execute JShell online go to next URL 18 | 19 | https://tryjshell.org 20 | 21 | Verify you are using JShell for Java 10 version 22 | 23 | | Welcome to JShell -- Version 10 24 | | For an introduction type: /help intro 25 | 26 | 27 | Once you are on JShell, try to do next exercises using Variable Type Inference 28 | 29 | - Make a sum of two number of the type int, and print the result 30 | - Declare text using String, StringBuilder, StringBuffer 31 | - Declare collections as List, ArrayList, Set, Map 32 | 33 | For Object type you can use the method getClass() to check the type that the compiler used. 34 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/AnonymousInnerClass.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.Arrays; 3 | import java.util.List; 4 | 5 | // **************************************************************************************************************** 6 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 7 | // **************************************************************************************************************** 8 | public class AnonymousInnerClass { 9 | public static void main(String args[]) { 10 | // Is this allowed, and will it compile? 11 | var myReversibleStringList = new ArrayList() { 12 | List list() { 13 | return Arrays.asList("Larry", "Moe", "Curly"); 14 | } 15 | }; 16 | System.out.println(myReversibleStringList.list()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/EnhancedForLoop.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | 3 | // **************************************************************************************************************** 4 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 5 | // **************************************************************************************************************** 6 | public class Keywordvar { 7 | public static void main(String args[]) { 8 | // In combination with the <> Operator, infers to List ??? = Object or String or Array? 9 | var arrayOfObjects = new ArrayList<>(); 10 | arrayOfObjects.add("Hello World"); 11 | for (var elementIsObject: arrayOfObjects) { 12 | System.out.println(elementIsObject.replace("World", "Java 10")); // cannot find symbol 'replace' as elementIsObject is of type object 13 | } 14 | 15 | // Infers to List // Is this allowed, and will it compile? ??? = Object or String or Array 16 | var arrayOfStrings = new ArrayList(); 17 | arrayOfStrings.add("Hello World"); 18 | for (var string: arrayOfStrings) { 19 | System.out.println(string.replace("World", "Java 10")); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/LambdaExpressions.java: -------------------------------------------------------------------------------- 1 | // **************************************************************************************************************** 2 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 3 | // **************************************************************************************************************** 4 | public class LambdaExpressions { 5 | public static void main(String args[]) { 6 | var compareString = String::compareTo; // is this allowed? 7 | 8 | // Is this possible, what does the compiler say? 9 | Consumer printer = (var s) -> System.out.println(s); // statt s -> System.out.println(s); 10 | 11 | // Is a mixture of "var" and declarated types possible? 12 | BiConsumer printer = (var s1, String s2) -> System.out.println(s1 + " " + s2); 13 | 14 | // Is this possible, what does the compiler say? 15 | BiConsumer printer = (@Nonnull var s1, @Nullable var s2) -> System.out.println(s1 + (s2 == null ? "" : " " + s2)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/LocalVariable.java: -------------------------------------------------------------------------------- 1 | // **************************************************************************************************************** 2 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 3 | // **************************************************************************************************************** 4 | public class LocalVariable { 5 | public static void main(String args[]) { 6 | // Local variable 7 | String a = "some string"; 8 | var aVarVariable = "String"; 9 | System.out.println(aVarVariable); 10 | 11 | // Re-assigning local variable 12 | aVarVariable = "Changed value"; // <=== is this allowed, does it compile? 13 | System.out.println(aVarVariable); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/PrimitivesAndBigDecimal.java: -------------------------------------------------------------------------------- 1 | import java.math.BigDecimal; 2 | 3 | // **************************************************************************************************************** 4 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 5 | // **************************************************************************************************************** 6 | public class PrimitivesAndBigDecimal { 7 | public static void main(String args[]) { 8 | // int 9 | var integerValue = 5; 10 | // String 11 | var stringValue = "Hello World"; 12 | // BigDecimal 13 | var bigDecimal = BigDecimal.ONE; 14 | bigDecimal = BigInteger.TEN; // <=== is this allowed, does it compile 15 | 16 | final var finalInteger = 10; // <=== something similar in Scala? is this allowed, does it compile 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/README.md: -------------------------------------------------------------------------------- 1 | ### JEP 286: Local-Variable Type Inference 2 | 3 | Run the below command on any of the below `java` source files in the current directory: 4 | 5 | ```bash 6 | javac AnonymousInnerClass.java 7 | javac EnhancedForLoop.java 8 | javac LambdaExpressions.java 9 | javac LocalVariable.java 10 | javac PrimitivesAndBigDecimal.java 11 | javac README.md 12 | javac ReservedKeyword.java 13 | javac RestrictedUse.java 14 | javac WithCollections.java 15 | javac WithInterface.java 16 | javac WithStreams.java 17 | ``` 18 | 19 | What output will compiler produce: 20 | 21 | Follow the annotations in the respective source files to see what is happening per line. The compiler returns error messages per line that won't compile. 22 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/ReservedKeyword.java: -------------------------------------------------------------------------------- 1 | // **************************************************************************************************************** 2 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 3 | // **************************************************************************************************************** 4 | public class ReservedKeyword { 5 | public static void main(String args[]) { 6 | // does it work / compile? 7 | var var = "Similar to Scala’s var keyword. Although in Java, var is not a keyword, but a 'reserved type name'"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/RestrictedUse.java: -------------------------------------------------------------------------------- 1 | // **************************************************************************************************************** 2 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 3 | // **************************************************************************************************************** 4 | public class RestrictedUse { 5 | public static void main(String args[]) { 6 | // Just declaration of local variable 7 | var aVarVariable; // <=== is this allowed, will it compile? 8 | 9 | // Declaration and assigning of local variable to null 10 | var aVarVariable = null; // <=== is this allowed, will it compile? 11 | 12 | var varVariable = funcReturningNull(); // <=== is this allowed, will it compile? 13 | 14 | var first, second = 0; // <=== is this allowed, will it compile? 15 | var first = 1, second = 2; // <=== is this allowed, will it compile? What does the compiler say? 16 | } 17 | 18 | private static Object funcReturningNull() { 19 | return null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/WithCollections.java: -------------------------------------------------------------------------------- 1 | import java.util.HashMap; 2 | 3 | // **************************************************************************************************************** 4 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 5 | // **************************************************************************************************************** 6 | public class WithCollections { 7 | public static void main(String args[]) { 8 | var map = new HashMap<>(); 9 | var varMap = new HashMap<>(); // infers as HashMap, does it works, and compiles? what is ???? Object? String? 10 | 11 | var x = new HashMap(); // infers as HashMap, does it work or compile, what are AAA, BBB? 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/WithInterface.java: -------------------------------------------------------------------------------- 1 | // **************************************************************************************************************** 2 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 3 | // **************************************************************************************************************** 4 | public class WithInterface { 5 | public static void main(String args[]) { 6 | // Would this work and compile? 7 | var runnable = new Runnable() { 8 | @Override 9 | public void run() { 10 | } 11 | }; 12 | 13 | // Would this work and compile? Whats the new type? 14 | runnable = new Runnable() { 15 | @Override 16 | public void run() { 17 | } 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java10/JEP_286_Local-Variable_Type_Inference/06_More_Exercises/WithStreams.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.List; 3 | import java.util.stream.Stream; 4 | 5 | // **************************************************************************************************************** 6 | // Citation: the below examples are compilation of a number of links from the java10/Java-10-Resources.md document 7 | // **************************************************************************************************************** 8 | public class WithStreams { 9 | public static void main(String args[]) { 10 | // Declaration and assigning of local variable by executing a method 11 | Stream stream = getStream(); // <=== infers type ?????, is this allowed or compiles? 12 | 13 | var varStream = getStream(); // Would this work and compile? 14 | } 15 | 16 | public static Stream getStream() { 17 | // Local variable with streams 18 | List strings = Arrays.asList("abc", "", "bc", "efg", "abcd","", "jkl"); 19 | 20 | return strings.stream(); // Would this work and compile? 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java10/JEP_313_Remove_the_Native-Header_Generation_Tool_(javah)/NativeTest.java: -------------------------------------------------------------------------------- 1 | public class NativeTest { 2 | 3 | static { 4 | System.loadLibrary("hello"); 5 | } 6 | 7 | private native void sayHello(); 8 | 9 | public static void main(String[] args) { 10 | new NativeTest().sayHello(); 11 | } 12 | } -------------------------------------------------------------------------------- /java10/JEP_313_Remove_the_Native-Header_Generation_Tool_(javah)/README.md: -------------------------------------------------------------------------------- 1 | ### JEP 313: Remove the Native-Header Generation Tool (javah) 2 | 3 | Where to look for the absence of `javah`: 4 | 5 | ```bash 6 | ls ??????? 7 | ``` 8 | 9 | Hint: where is JAVA_HOME pointing? 10 | 11 | Have you been able to locate the `javah` command in the lists? 12 | 13 | How do you generate headers now? 14 | 15 | ```bash 16 | jav?? ?? . NativeTest.java 17 | ``` 18 | 19 | What do the ?? stand for? What does the compiler produce in the current directory. 20 | 21 | Check contents of the file by doing: 22 | 23 | ```bash 24 | cat NativeTest.h 25 | ``` 26 | 27 | Does the header file should contain information related to header information? 28 | -------------------------------------------------------------------------------- /java10/JEP_314_Additional_Unicode_Language-Tag_Extensions/README.md: -------------------------------------------------------------------------------- 1 | **JEP 314: Additional Unicode Language-Tag Extensions example** 2 | 3 | 4 | Java SE 9 support BCP 47 U language-tag extensions to `calendars (ca)` and `numbers (nu)`. Java 10 add support for the additional extensions: 5 | 6 | cu (currency type) 7 | fw (first day of week) 8 | rg (region override) 9 | tz (time zone) 10 | 11 | 12 | This example show how those extensions can be used to combine or create much more specific Locales. This example is design to be work on JShell, but if you want you can try to make it on a Java Class. 13 | 14 | 15 | You can run this example on your local JShell or online. For more information about JShell you can go to: https://github.com/AdoptOpenJDK/jdk9-jigsaw/tree/master/session-3-jshell 16 | 17 | To execute Local JShell run next command 18 | 19 | jshell 20 | 21 | Verify you are using JShell for Java 10 version 22 | 23 | | Welcome to JShell -- Version 10 24 | | For an introduction type: /help intro 25 | 26 | 27 | To execute JShell online go to next URL 28 | 29 | https://tryjshell.org 30 | 31 | Verify you are using JShell for Java 10 version 32 | 33 | | Welcome to JShell -- Version 10 34 | | For an introduction type: /help intro 35 | 36 | 37 | Once you are on JShell, try to do next exercises. 38 | 39 | 40 | 41 | 1. Create a Locale for your country using the two parameters constructor 42 | 43 | Locale myLocale = new Locale("es","CO"); // `es` is for the language Spanish and `CO` for the country Colombia 44 | 45 | Next link is useful to know the values for each country https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry 46 | 47 | 2. Run next statements and take note of the results 48 | 49 | System.out.println(Currency.getInstance(myLocale)); // it shows your country's currency 50 | 51 | System.out.println(Calendar.getInstance(myLocale).getFirstDayOfWeek()); // it shows your country's first Day of the week: 1 for Sunday, 2 for Monday, 3 for Wednesday and so on. 52 | 53 | System.out.println(NumberFormat.getInstance(myLocale).format(123456789)); // it shows your country's number format style 54 | 55 | System.out.println(DateFormat.getDateInstance(1,myLocale).format(new Date())); // it shows your country's date 56 | 57 | 3. Now, work in pairs, each one choose a different language/country, it is much better if the countries are in different continents, 58 | create a new Locale, execute the same statements of previous step and compare the result. 59 | 60 | 4. Finally we are going to use the extension support added on Java 10, this time you must create your Locale using a `Local.Builder` as it shows next. 61 | Replace the letters xx and YY for the Language / Country that you used in the first exercise, and then execute the statements of the step number 2. 62 | **Note:** If you are testing with France you must change the FR letters on `FRzzzz` for other country, e.g. `UKzzzz`, `COzzzz`, `BRzzzz` 63 | 64 | Locale myLocale = new Locale.Builder().setLanguage("xx").setRegion("YY") .setExtension('u',"rg-FRzzzz").build(); 65 | 66 | 5. The final challenge is to define un Locale for your country, that uses a different language, with Friday as the first 67 | day of the week, USD as currency and uses Javanese digits. You should use the statements in the step number two to test your Locale. 68 | You can use next commando to verify the Locale tha you have created: 69 | 70 | System.out.println(myLocale.getDisplayName()); 71 | -------------------------------------------------------------------------------- /java10/JEP_319_Root_Certificates/README.md: -------------------------------------------------------------------------------- 1 | ### JEP 319: Root Certificates 2 | 3 | ``` 4 | $ ???tool -cacerts -[option] | grep "Certificate" 5 | Enter keystore password: changeit <== default password to the keystore 6 | ``` 7 | [???] What word to use for the name of the security tool 8 | [option] What option displays all CA certificates in your keystore 9 | 10 | ``` 11 | Certificate fingerprint (SHA-256): 3A:43:E2:20:FE:7F:3E:A9:65:3D:1E:21:74:2E:AC:2B:75:C2:0F:D8:98:03:05:BC:50:2C:AF:8C:2D:9B:41:A1 12 | Certificate fingerprint (SHA-256): 7E:37:CB:8B:4C:47:09:0C:AB:36:55:1B:A6:F4:5D:B8:40:68:0F:BA:16:6A:95:2D:B1:00:71:7F:43:05:3F:C2 13 | Certificate fingerprint (SHA-256): 23:99:56:11:27:A5:71:25:DE:8C:EF:EA:61:0D:DF:2F:A0:78:B5:C8:06:7F:4E:82:82:90:BF:B8:60:E8:4B:3C 14 | Certificate fingerprint (SHA-256): 55:2F:7B:DC:F1:A7:AF:9E:6C:E6:72:01:7F:4F:12:AB:F7:72:40:C7:8E:76:1A:C2:03:D1:D9:D2:0A:C8:99:88 15 | Certificate fingerprint (SHA-256): CB:B5:AF:18:5E:94:2A:24:02:F9:EA:CB:C0:ED:5B:B8:76:EE:A3:C1:22:36:23:D0:04:47:E4:F3:BA:55:4B:65 16 | Certificate fingerprint (SHA-256): 30:D0:89:5A:9A:44:8A:26:20:91:63:55:22:D1:F5:20:10:B5:86:7A:CA:E1:2C:78:EF:95:8F:D4:F4:38:9F:2F 17 | Certificate fingerprint (SHA-256): 6F:FF:78:E4:00:A7:0C:11:01:1C:D8:59:77:C4:59:FB:5A:F9:6A:3D:F0:54:08:20:D0:F4:B8:60:78:75:E5:8F 18 | ... <== 80 or more Certificates should be displayed 19 | ``` 20 | 21 | Compare CA names mentioned on [JEP 319](http://openjdk.java.net/jeps/319) with above output. 22 | -------------------------------------------------------------------------------- /java10/Java-10-Resources.md: -------------------------------------------------------------------------------- 1 | # Java/JDK 10 Resources 2 | 3 | ## JUG Hackday Resources 4 | 5 | - ...[Placeholder for next JUG event to take place]... 6 | 7 | *** 8 | 9 | ## Java/JDK 10 Resources 10 | 11 | - [General Availability / Early Access Download: OpenJDK and OracleJDK](http://jdk.java.net/10/); 12 | - [Installation Guide](https://docs.oracle.com/javase/10/install/overview-jdk-10-and-jre-10-installation.htm#JSJIG-GUID-8677A77F-231A-40F7-98B9-1FD0B48C346A) 13 | - [Details on Java 10 supported platforms](http://www.oracle.com/technetwork/java/javase/documentation/jdk10certconfig-4417031.html) 14 | 15 | ## Oracle/OpenJDK Resources on Java 10 16 | 17 | - [JDK 10 Project Page](http://openjdk.java.net/projects/jdk/10/); includes a list of JEPs targeted for Java 10 (see [JDK Project](http://openjdk.java.net/projects/jdk/)) 18 | - [List of all JEPs](http://openjdk.java.net/jeps/0) 19 | - List of pre-Java 10/Java 10 bug fixes and enhancements: 20 | - [Official list](http://www.oracle.com/technetwork/java/javase/2col/10-0-1-bugfixes-4308880.html) 21 | - [Bugs database: JDK 10](https://www.oracle.com/search/results?Ntt=%22JDK%2010%22&Dy=1&Nty=1&cat=bugs&Ntk=S3) 22 | - [Bugs database: Java 10](https://www.oracle.com/search/results?Ntt=%22Java%2010%22&Dy=1&Nty=1&cat=bugs&Ntk=S3) 23 | - [CPU & Memory limits issue fix: JDK-8146115](https://bugs.openjdk.java.net/browse/JDK-8146115) 24 | - [Attaching to Namespace issue fix: JDK-8179498](https://bugs.openjdk.java.net/browse/JDK-8179498) 25 | - [Check release notes for more enhancements](http://www.oracle.com/technetwork/java/javase/10-relnote-issues-4108729.html#NewFeature) 26 | - [Java 10 Documentation](https://docs.oracle.com/javase/10/index.html) 27 | - [JavaDoc](https://download.java.net/java/jdk10/docs/api/overview-summary.html) (API documentation) 28 | - [Quality Outreach](https://wiki.openjdk.java.net/display/quality/Quality+Outreach) (we could use your help here) 29 | 30 | ### Download Java 10 binaries 31 | - [Download JDK 10 binaries from OTN](http://www.oracle.com/technetwork/java/javase/downloads/index.html) [Alternative source](http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html) 32 | - [JDK 10 GA/Updates binaries](http://jdk.java.net/10/) 33 | - [JDK SE 10 RI binaries](http://jdk.java.net/java-se-ri/10) 34 | - [Adopt OpenJDK 10 binaries](https://ci.adoptopenjdk.net/) - look for the 'OpenJDK builds' tab 35 | 36 | *** 37 | 38 | ### Community resources 39 | 40 | - [Placeholder](...) (...Author) 41 | 42 | ### Talks 43 | 44 | - [Placeholder](...) (...Author) 45 | 46 | ### Interviews 47 | 48 | - [Placeholder](...) (...Author) 49 | 50 | ### JEPs and blog posts/articles 51 | 52 | #### Java 10 features: what others are saying! 53 | 54 | - [How Java 10 will CHANGE the Way You Code | OverOps Blog](https://blog.takipi.com/how-java-10-will-change-the-way-you-code/) 55 | - [Java 10: New Features And Enhancements - DZone Java](https://dzone.com/articles/java-10-new-features-and-enhancements) 56 | - [Java 10 JDK: The new features in Java 10 | InfoWorld](https://www.infoworld.com/article/3230507/java/java-jdk-10-what-new-features-to-expect-in-the-next-java.html) 57 | - [10 new features in java 10!](https://aboullaite.me/10-new-features-in-java-10/) 58 | - [JDK 10: 10 new features and enhancements in Java 10](http://www.thewindowsclub.com/java-10-new-features) 59 | - [It is time for Java 10 - All new features and release notes - JAXenter](https://jaxenter.com/java-10-is-finally-here-lets-have-a-look-at-its-new-features-142654.html) 60 | - [Features in Java 10 - DZone Java](https://dzone.com/articles/features-in-java-10) 61 | - [Java 10 – An Introduction](https://blog.idrsolutions.com/2018/04/java-10-an-introduction/) (Bethan Palmer, Developer at IDR Solutions) 62 | 63 | [JEP 286](http://openjdk.java.net/jeps/286) Local-Variable Type Inference: 64 | 65 | - [Java 10 Local-Variable Type Inference Explained in 5 Minutes](https://blog.idrsolutions.com/2018/04/java-10-local-variable-type-inference-explained-in-5-minutes) (Bethan Palmer, Developer at IDR Solutions) 66 | - [Java 10 Sneak Peek: Local-Variable Type Inference (var)!](https://medium.com/@afinlay/java-10-sneak-peek-local-variable-type-inference-var-3022016e1a2b) (Adrian D. Finlay) 67 | - [First Contact With ‘var’ In Java 10](https://blog.codefx.org/java/java-10-var-type-inference/) (Codefx, Nicolai Parlog) 68 | - [See under Value Types of The Top 3 Java Performance Improvements we're looking forward to](https://www.opsian.com/blog/top-3-java-performance-improvements/) 69 | 70 | [JEP 296](http://openjdk.java.net/jeps/296) Consolidate the JDK Forest into a Single Repository: 71 | 72 | - [Oracle Consolidates the OpenJDK 10 Repository Forest](https://www.infoq.com/news/2017/09/openjdk-10-consolidated-repo) (Abraham Marín Pérez) 73 | 74 | [JEP 304](http://openjdk.java.net/jeps/304) Garbage-Collector Interface: 75 | 76 | - [Java 10 improvements to Garbage Collection explained in 5 minutes](https://blog.idrsolutions.com/2018/04/java-10-improvements-to-garbage-collection-explained-in-5-minutes/) (Rob, Software Engineer at IDRSolutions) 77 | - Related JEPs: [JEP 318 - Epsilon: An Arbitrarily Low-Overhead Garbage Collector](http://openjdk.java.net/jeps/318) and [JEP 189 – Shenandoah: An Ultra-Low-Pause-Time GC](http://openjdk.java.net/jeps/189) 78 | 79 | [JEP 307](http://openjdk.java.net/jeps/307) Parallel Full GC for G1: 80 | 81 | - [Java 10 improvements to Garbage Collection explained in 5 minutes](https://blog.idrsolutions.com/2018/04/java-10-improvements-to-garbage-collection-explained-in-5-minutes/) (Rob, Software Engineer at IDRSolutions) 82 | - [#Java Training Session](https://twitter.com/java/status/986759064481878016) (Twitter handle @Java) 83 | - [JEP 307: Parallel Full GC for G1 - discussion thread on OpenJDK mailing list](http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2017-July/020307.html) (Members of the OpenJDK HotSpot group) 84 | - [Java on Docker will no longer suck: improvements coming in Java 10](https://www.opsian.com/blog/java-10-with-g1/) (By Richard Warburton, Sadiq Jaffer from Opsian) 85 | 86 | [JEP 310](http://openjdk.java.net/jeps/310) Application Class-Data Sharing: 87 | 88 | - [Improve Launch Times On Java 10 With Application Class-Data Sharing](https://blog.codefx.org/java/application-class-data-sharing/) (Codefx, Nicolai Parlog) 89 | - [#Java Training Session shared by @Java](https://twitter.com/java/status/986759064481878016) 90 | 91 | [JEP 312](http://openjdk.java.net/jeps/312) Thread-Local Handshakes: 92 | 93 | - [Discussions on StackOverflow](https://stackoverflow.com/questions/47222819/explanation-of-the-thread-local-handshakes) (SO Community) 94 | 95 | [JEP 313](http://openjdk.java.net/jeps/313) Remove the Native-Header Generation Tool (javah): 96 | 97 | - [SO discussion on generating native header file](https://stackoverflow.com/questions/21663423/generating-header-file-with-jni-using-javah) (SO Community) 98 | 99 | [JEP 314](http://openjdk.java.net/jeps/314) Additional Unicode Language-Tag Extensions: 100 | 101 | - [Internationalization Enhancements in JDK 10](https://docs.oracle.com/javase/10/intl/internationalization-enhancements-jdk-10.htm#JSINT-GUID-B76A32BB-DB66-4B51-BA06-F88B562B5A59) 102 | 103 | [JEP 316](http://openjdk.java.net/jeps/316) Heap Allocation on Alternative Memory Devices: 104 | 105 | - [Discussion on OpenJDK mailing list](http://openjdk.5641.n7.nabble.com/RFR-M-8171181-Supporting-heap-allocation-on-alternative-memory-devices-td300109.html) (OpenJDK Community) 106 | 107 | [JEP 317](http://openjdk.java.net/jeps/317) Experimental Java-Based JIT Compiler: 108 | 109 | - [Java 10’s Experimental JIT Compiler explained in 5 minutes](https://blog.idrsolutions.com/2018/04/java-10-project-graal-explained-5-minutes/) (Georgia Ingham, Java Developer at IDRSolutions) 110 | - [#Java Training Session](https://twitter.com/java/status/986759064481878016) (Twitter handle @Java) 111 | - Related JEPs: [JEP 243: Java-Level JVM Compiler Interface](http://openjdk.java.net/jeps/243) and [JSR 223: Scripting for the Java Platform](https://www.jcp.org/en/jsr/detail?id=223) (also see [Scripting for the Java Platform](https://en.wikipedia.org/wiki/Scripting_for_the_Java_Platform)) 112 | - [Awesome-graal](https://github.com/neomatrix369/awesome-graal/blob/master/README.md) 113 | 114 | [JEP 319](http://openjdk.java.net/jeps/319) Root Certificates: 115 | 116 | - [OpenJDK 10 Now Includes Root CA Certificates](https://dzone.com/articles/openjdk-10-now-includes-root-ca-certificates) (Jim Connors) 117 | - [Configure and populate the cacerts keystore with a set of root certificates - prior to JDK 10](http://www.oracle.com/technetwork/java/javase/9all-relnotes-3704433.html#JDK-8189131) (JavaDocs by Oracle) 118 | 119 | [JEP 322](http://openjdk.java.net/jeps/322) Time-Based Release Versioning: 120 | 121 | - [Tweet from @Java](https://twitter.com/java/status/976163714700324866) (Twitter handle @Java) 122 | - [No Free Java LTS Version?](https://medium.com/codefx-weekly/no-free-java-lts-version-b850192745fb) (Codefx, Nicolai Parlog) 123 | - [Back to JDK 10: “Most feature releases should contain at least one or two significant features”](https://jaxenter.com/jdk-10-feature-releases-new-scheme-138603.html) (Gabriela Motroc from jaxenter) 124 | 125 | Docker fixes and enhancements: 126 | - [Java on Docker will no longer suck: improvements coming in Java 10](https://www.opsian.com/blog/java-on-docker/) (By Richard Warburton, Sadiq Jaffer from Opsian) 127 | 128 | ### General blog posts, presentations, slides 129 | 130 | - [The Top 3 Java Performance Improvements we're looking forward to](https://www.opsian.com/blog/top-3-java-performance-improvements/) (By Richard Warburton, Sadiq Jaffer from Opsian) - a mix of Java 9, 10 and 11 131 | - [How Java 10 will improve performance](https://blog.idrsolutions.com/2018/04/java-10-will-improve-performance/) (Kieran France, Programmer for IDRSolutions) 132 | - [HotSpot VM Options for JDK10](https://chriswhocodes.com/hotspot_options_jdk10.html) 133 | 134 | ### Books 135 | 136 | * [....]() (Publisher; Author) 137 | 138 | ### Courses 139 | 140 | * [....] (...., (link)[link]) 141 | 142 | ### Repositories 143 | 144 | - [CodeFX-org/demo-java-10](https://github.com/CodeFX-org/demo-java-10) (Codefx, Nicolai Parlog) 145 | 146 | #### Misc 147 | 148 | - [Oracle released JDK 10 press release](https://www.oracle.com/corporate/pressrelease/Java-10-032018.html) 149 | - [A blog post related to Java 10 release](https://blogs.oracle.com/java-platform-group/introducing-java-se-10) 150 | - [Java 10 White Paper from Oracle](https://developer.oracle.com/devo/res/pdf/1385446602743/Oracle-Java10.pdf) 151 | -------------------------------------------------------------------------------- /java10/README.md: -------------------------------------------------------------------------------- 1 | # Java 10 2 | 3 | Exercises based on some of the features of Java 10 released in the Early Access / General Availability build of JDK10. 4 | 5 | ___ 6 | 7 | #### Please note you are in the `master` branch which contains exercises which need to be solved by looking at documentation or resources provided in this repo. Hints may be provided within the source or script files. If you hit a roadblock and really want to see a possible solution you can switch to the `exercise-solutions` branch for that. 8 | 9 | #### Looking at the solutions can take away the challenge behind solving the exercises. Stay on the `master` branch in case you would like to continue to have fun solving the exercises and working through the challenges. 10 | 11 | [Switch to exercise-solutions branch](https://github.com/neomatrix369/java-10-and-beyond/blob/exercise-solutions/java10/README.md) 12 | 13 | ___ 14 | 15 | ## Setup (all platforms) 16 | 17 | See [Download, install and verify JDK](setupAndVerifyJDK.md) and return to this page to continue with the rest of the steps. 18 | 19 | #### Download and install `git` or `git-bash` 20 | 21 | - Ensure you have a `git` client installed on your local machine/VM/vagrant box, for Windows users `git-bash` is recommended 22 | 23 | #### Download and install the `tree` and `wget` command 24 | 25 | See [Download and install tree and wget](setupTreeAndWget.md) and return to this page to continue with the rest of the steps. 26 | 27 | #### Vagrant box 28 | 29 | - Alternatively a Vagrant box is available at https://github.com/ali-ince/LJC_April2017_Hackday, please make use of this facility (thanks @ali-ince). 30 | 31 | #### (Optional) Install JDK 10 compliant IDE 32 | 33 | - Install the latest IDE (IntelliJ, Eclipse, NetBeans - paid or community version) that supports JDK 10 EA, once installed configure the IDE to pickup the JDK 10 EA installed in the previous steps. 34 | 35 | See [Download, install and configure Eclipse Oxygen for JDK10](setupEclipseOxygen.md). 36 | 37 | #### Other preparations 38 | 39 | - Get familiar with the command-line a bit as we will be using much of it during the weekend 40 | 41 | - Prepare your VMs or cloud instances with the above, in case your local machine is not up for any installation or configurations 42 | 43 | **Note:** the bash files provided should work on Linux and in theory on the MacOS as well. 44 | 45 | ##### Windows users 46 | 47 | - if you use `git-bash` (recommended) or `cgywin` should work for you - run the `.sh` scripts in one of the the environments. In the worst case scenario, we would have to manually convert the `.sh` files into `.bat`, with minor tweaks should also work there. Happy to receive a pull request for it. Or you could use **bach**, a platform independent Java Shell Builder. It's usage is explained in `session-3-jshell`. 48 | - check if the literal JDK path (or `%JAVA_HOME%`) has been added to the `PATH` environment variable or add it manually 49 | - ensure the JDK is installed in a folder where the name does not have a space in it 50 | - in case folder name looks something `C:\Program files...`, ensure that (name does not contain spaces): 51 | - the path to the JDK in `JAVA_HOME` has `C:\Program~1` instead of `C:\Program files...` 52 | - the environment variable `PATH` refers to the `JAVA_HOME` environment variable 53 | - the environment variable `CLASSPATH` refers to the `JAVA_HOME` environment variable 54 | - in some instances `jlink` was not yet available when JDK is installed via the `.exe` file, even after the above path settings were applied (please verify beforehand) 55 | 56 | ## Exercises / examples covered 57 | 58 | Please ensure you have verified that the necessary JDK programs work in your environment with the help of the [Download, install and verify JDK](setupAndVerifyJDK.md) resource. 59 | 60 | - Session 1: [JEP 296](http://openjdk.java.net/jeps/296): Local-Variable Type Inference 61 | - [Local Variable Type Inference for Primitive Data Types](JEP_286_Local-Variable_Type_Inference/01_Primitive_Data_Types/README.md) 62 | - [Local Variable Type Inference for Object Data Types](JEP_286_Local-Variable_Type_Inference/02_Object_Data_Types/README.md) 63 | - [Local Variable Type Inference for Arrays Data Types](JEP_286_Local-Variable_Type_Inference/03_Arrays_Data_Types/README.md) 64 | - [Local Variable Type Inference for all Types](JEP_286_Local-Variable_Type_Inference/04_Full_uses/README.md) 65 | - [JShell: Local Variable Type Inference for all Types](JEP_286_Local-Variable_Type_Inference/05_JShell/README.md) 66 | 67 | - [Exercises on how to use the `var` keyword in Java 10](JEP_286_Local-Variable_Type_Inference/06_More_Exercises/README.md) 68 | 69 | - Session 2: [JEP 313](http://openjdk.java.net/jeps/313): Remove the Native-Header Generation Tool (javah) 70 | - [Exercises on how to check for removed functionality and its alternative solution](./JEP_313_Remove_the_Native-Header_Generation_Tool_(javah)/README.md) 71 | 72 | - Session 3: [JEP 319](http://openjdk.java.net/jeps/319): Root Certificates 73 | - [Exercises on how to check for the new added functionality](./JEP_319_Root_Certificates/README.md) 74 | 75 | - Session 4: [JEP 314](http://openjdk.java.net/jeps/314) Additional Unicode Language-Tag Extensions 76 | - [Additional Unicode Language-Tag Extensions](JEP_314_Additional_Unicode_Language-Tag_Extensions/README.md) 77 | 78 | Each example is enclosed in a folder of its own containing bash scripts to compile, package and run the respective examples. Use these scripts for each of the examples. 79 | 80 | ## Community contributions 81 | 82 | See [guidelines on how to contribute](CONTRIBUTING.md). 83 | 84 | ## License 85 | 86 | See [License](LICENSE) document to find out about the licensing terms and conditions. 87 | 88 | ## Resources 89 | 90 | ### Must reads 91 | - [Features in Java 10](https://dzone.com/articles/features-in-java-10) 92 | - [What's Planned for JDK 10?](https://dzone.com/articles/whats-planned-for-jdk-10) 93 | - [Java 10 Checklist: Meet the Declaration That Will Change the Way You Code](https://blog.takipi.com/java-10-checklist-meet-the-declaration-that-will-change-the-way-you-code/) 94 | 95 | ### Other resources 96 | - [JDK 10 Resources](./Java-10-Resources.md) 97 | - [Adopt OpenJDK homepage](https://adoptopenjdk.java.net/) 98 | - [Adopt OpenJDK: Getting Started Kit](http://bit.ly/1NUkPWw) 99 | 100 | --- 101 | -------------------------------------------------------------------------------- /java10/common-functions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This is just common bash code used by scripts in the modules 4 | 5 | set -eu 6 | 7 | # Escape code 8 | esc=$(echo -en "\033") 9 | 10 | info="${esc}[0;33m" 11 | normal=$(echo -en "${esc}[m\017") 12 | 13 | java -version 2>&1 | grep -q '"10' || (echo "**** Fix your PATH! ****" && java -version && exit 1) 14 | javac -version 2>&1 | grep -q '10' || (echo "**** Fix your PATH! Cannot find command 'javac' (version 10) ****" && javac -version && exit 1) 15 | 16 | runTree() 17 | { 18 | if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] ; then 19 | cmd //c "tree /f /a $1" 20 | else 21 | tree -fl $1 22 | fi 23 | } 24 | -------------------------------------------------------------------------------- /java10/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | # Common variables 6 | JDK_DESTINATION=$(echo ```pwd```) 7 | JDK_FOLDER_NAME="jdk-10" 8 | JDK_HOME_OS_SPECIFIC="$JDK_DESTINATION/$JDK_FOLDER_NAME" 9 | JDK_DOWNLOAD_BASE_URL="http://download.java.net" 10 | 11 | # Common functions 12 | function checkIfJDKIsDownloaded() { 13 | echo "" 14 | echo "Checking if the JDK has already been downloaded..." 15 | if [ ! -f "$JDK_TAR_FILE_NAME" ]; then 16 | if [[ $JDK_NAME_GENERIC == "jdk-10+" ]]; then 17 | echo "No JDK does not exist, downloading now..." 18 | wget --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" -O $JDK_TAR_FILE_NAME "${JDK_DOWNLOAD_BASE_URL}/java/jdk10/archive/${BUILD_NUMBER}/binaries/${JDK_TAR_FILE_NAME}" 19 | fi 20 | else 21 | echo -e "The JDK ($JDK_TAR_FILE_NAME) has already been downloaded." 22 | fi 23 | } 24 | 25 | function checkIf_JAVA_HOME_IsSet() { 26 | JAVA_HOME_IS_SET=$(echo `echo $JAVA_HOME | grep "$JDK_HOME_OS_SPECIFIC"`) 27 | echo "" 28 | if [ -z $JAVA_HOME_IS_SET ]; then 29 | echo -e "JAVA_HOME does not point at $JDK_HOME_OS_SPECIFIC" 30 | echo -e "Please make it point at $JDK_HOME_OS_SPECIFIC with the below command:" 31 | echo "" 32 | echo -e " export JAVA_HOME=$JDK_HOME_OS_SPECIFIC" 33 | echo "" 34 | echo "If needed add this to your .bashrc or .bash_profile settings." 35 | else 36 | echo -e "JAVA_HOME points at $JAVA_HOME" 37 | fi 38 | } 39 | 40 | function checkIf_PATH_IsSet() { 41 | PATH_IS_SET=$(echo `echo $PATH | grep "$JDK_HOME_OS_SPECIFIC_BIN"`) 42 | echo "" 43 | if [ -z $PATH_IS_SET ]; then 44 | echo -e "PATH does not contain $JDK_HOME_OS_SPECIFIC_BIN" 45 | echo -e "Please make it also point at it with the below command:" 46 | echo "" 47 | echo -e " export PATH=$JDK_HOME_OS_SPECIFIC_BIN:\$PATH" 48 | echo "" 49 | echo "If needed add this to your .bashrc or .bash_profile settings." 50 | else 51 | echo -e "PATH contains $JDK_HOME_OS_SPECIFIC_BIN" 52 | fi 53 | } 54 | 55 | function checkIfTheRightJava10CommandsAreBeingExecuted() { 56 | echo "" 57 | echo "Running javac with the -version option, to verify if the right JDK 10 commands are being executed." 58 | javac -version 59 | 60 | echo "" 61 | echo "Running java with the -version option, to verify if the right JDK 10 commands are being executed." 62 | java -version 63 | } 64 | -------------------------------------------------------------------------------- /java10/getJDK10.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | # Import common variables 6 | source common.sh 7 | 8 | # Binary name and download path composed with these values and current version 9 | JDK_NAME_GENERIC="jdk-10+" 10 | JDK_NAME_LINUX="_linux-x64_bin.tar.gz" 11 | JDK_NAME_OSX="_osx-x64_bin.dmg" 12 | 13 | if [[ "$OSTYPE" == "darwin"* ]]; then 14 | JDK_DESTINATION="/Library/Java/JavaVirtualMachines" 15 | fi 16 | 17 | JDK_DOWNLOAD_HOME_PAGE="http://jdk.java.net/10/" 18 | BUILD_NUMBER=$(curl $JDK_DOWNLOAD_HOME_PAGE/ | grep "Most recent build" | awk '{print $4}' | tr -d "" | perl -nle 'print$& if m{jdk\-10\+\K\w+}') 19 | 20 | if [[ "$OSTYPE" == "darwin"* ]]; then 21 | JDK_TAR_FILE_NAME=$JDK_NAME_GENERIC$BUILD_NUMBER$JDK_NAME_OSX 22 | JDK_FOLDER_NAME="$JDK_FOLDER_NAME.jdk" 23 | JDK_HOME_OS_SPECIFIC="$JDK_DESTINATION/$JDK_FOLDER_NAME/Contents/Home" 24 | else 25 | JDK_TAR_FILE_NAME=$JDK_NAME_GENERIC$BUILD_NUMBER$JDK_NAME_LINUX 26 | fi 27 | 28 | JDK_HOME_OS_SPECIFIC_BIN="$JDK_HOME_OS_SPECIFIC/bin" 29 | 30 | function checkIfJDKIsInstalled() { 31 | echo "" 32 | echo "Checking if the JDK has already been installed..." 33 | 34 | if [[ "$OSTYPE" == "darwin"* ]]; then 35 | echo "Since you are using Mac OS X/macOS, .tar.gz files are not provided anymore." 36 | echo "Please mount ${JDK_TAR_FILE_NAME} on Finder and install JDK 10. It will be installed at ${JDK_DESTINATION}/${JDK_FOLDER_NAME}." 37 | return 38 | fi 39 | 40 | if [ ! -d "$JDK_HOME_OS_SPECIFIC" ]; then 41 | echo "Unpacking the JDK..." 42 | tar xzvf $JDK_TAR_FILE_NAME 43 | echo "" 44 | echo "Installing the JDK into $JDK_HOME_OS_SPECIFIC." 45 | else 46 | echo -e "The JDK ($JDK_FOLDER_NAME) has already been installed at $JDK_DESTINATION." 47 | fi 48 | } 49 | 50 | checkIfJDKIsDownloaded 51 | checkIfJDKIsInstalled 52 | checkIf_JAVA_HOME_IsSet 53 | checkIf_PATH_IsSet 54 | checkIfTheRightJava10CommandsAreBeingExecuted 55 | -------------------------------------------------------------------------------- /java10/setupAndVerifyJDK.md: -------------------------------------------------------------------------------- 1 | ## Download, install and verify JDK 2 | 3 | #### Download and install latest version of the JDK 10 EA 4 | 5 | - Download JDK 10 EA 6 | 7 | - Early Access build of JDK10 is available at [http://jdk.java.net/10/](http://jdk.java.net/10/) 8 | 9 | - Install JDK 10 EA 10 | 11 | - Install using a script 12 | 13 | **Linux and MacOSX users only:** the bash script ```getJDK10.sh``` in the root directory of this repo, helps download the latest JDK from Oracle. Please run this once the repo is cloned. 14 | 15 | **Windows users:** please feel free to run this script and if there are any tweaks to get it to work successfully, please let us know via a pull request. 16 | 17 | - Install manually 18 | 19 | - Linux 20 | - `tar -xvf jdk-10*.tar` 21 | - `mv -f jdk-10 [destination]` (might need to use `sudo` here) 22 | - update your `.bashrc` with `export JAVA_HOME=[jdk destination]` 23 | - update your `.bashrc` with `export PATH=$JAVA_HOME/bin:$PATH` 24 | - `source ~/.bashrc` 25 | 26 | `[destination]` usually `/usr/lib/...` or related folder 27 | 28 | - MacOSX 29 | #### Manual way 30 | - Please refer to [this guide]( https://github.com/musinoli/guides/blob/master/setup_jigsaw.md) - thanks Nolita ([@musinoli](https://github.com/musinoli)) for your help 31 | - In case a `.dmg` file is available, download it and follow the installation steps, you will still have to update your `JAVA_HOME` and start script as mentioned in [this guide]( https://github.com/musinoli/guides/blob/master/setup_jigsaw.md). 32 | - update your `.bashrc` with `export PATH=$JAVA_HOME/bin:$PATH` 33 | 34 | #### Via Brew and jenv 35 | You will need the latest version of brew with cask support (1.1.13 at the time of writing). If you don't have brew installed, go [here](https://brew.sh/) first. 36 | - `brew install jenv` 37 | - `brew install caskroom/versions/java10-beta` 38 | 39 | You will need to make sure jenv is evaluated in every terminal session. Add `eval "$(jenv init -)"` to your shell's .rc file 40 | 41 | Now run `jenv versions`. The output might differ (if you have other JDK's installed) but in general you should see something like this: 42 | ``` 43 | ➜ ~ jenv versions 44 | system 45 | * 1.8 (set by /Users/ioannis/.jenv/version) 46 | 1.8.0.121 47 | 10-ea 48 | oracle64-1.8.0.121 49 | oracle64-10-ea 50 | ``` 51 | If `10-ea` or `oracle64-10-ea` does not appear, add it manually 52 | 53 | `jenv add /Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home` 54 | 55 | If you want to limit use of JDK 10 to source in a specific directory, switch to that directory and do: 56 | 57 | `jenv local 10-ea` 58 | 59 | e.g. 60 | ``` 61 | ➜ ~ cd test 62 | ➜ test: jenv local 10-ea 63 | ➜ test: jenv version 64 | 10-ea (set by /Users/ioannis/test/.java-version) 65 | ➜ test: java -version 66 | java version "10-ea" 67 | Java(TM) SE Runtime Environment (build 10-ea+163) 68 | Java HotSpot(TM) 64-Bit Server VM (build 10-ea+163, mixed mode) 69 | ``` 70 | 71 | - Windows 72 | - the file format has changed over time, so you might have downloaded either an `.exe` or a `.zip`. 73 | - If you have an executable file, then run it and follow the instructions 74 | - If you have a zip file, then just unzip it 75 | - Make a note of the destination 76 | - Edit the `JAVA_HOME` and `PATH` environment variables via the `My Computer` > `Properties` option 77 | - `JAVA_HOME`: `JAVA_HOME=[jdk destination]` 78 | - `PATH`: `PATH=%JAVA_HOME%/bin;%PATH%` 79 | 80 | `[destination]` usually `C:\Program Files\Java\...` or related folder 81 | 82 | ##### Verify JDK installation 83 | 84 | ###### java 85 | 86 | Say you have downloaded and installed the JDK 10 EA (build 165) binary from the above step, try the below commands: 87 | 88 | ``` 89 | $ java -version 90 | ``` 91 | 92 | As output you should get something like this: 93 | 94 | ``` 95 | java version "10-ea" 96 | Java(TM) SE Runtime Environment (build 10-ea+165) 97 | Java HotSpot(TM) 64-Bit Server VM (build 10-ea+165, mixed mode) 98 | ``` 99 | 100 | ###### javac 101 | 102 | ``` 103 | $ javac -version 104 | ``` 105 | 106 | As output you should get something like this: 107 | 108 | ``` 109 | javac 10-ea 110 | ``` 111 | 112 | ###### jlink 113 | 114 | Verify if `jlink` is available in your current environment: 115 | 116 | ``` 117 | $ jlink --version 118 | ``` 119 | 120 | As output you should get something like this: 121 | 122 | ``` 123 | 10 124 | ``` 125 | 126 | ###### jshell 127 | 128 | Verify if `jshell` is available in your current environment: 129 | 130 | ``` 131 | $ jshell --version 132 | ``` 133 | 134 | As output you should get something like this: 135 | 136 | ``` 137 | jshell 10 138 | ``` 139 | 140 | ###### jdeps 141 | 142 | Verify if `jdeps` is available in your current environment: 143 | 144 | ``` 145 | $ jdeps --version 146 | ``` 147 | 148 | As output you should get something like this: 149 | 150 | ``` 151 | 10 152 | ``` 153 | 154 | ###### jmod 155 | 156 | Verify if `jmod` is available in your current environment: 157 | 158 | ``` 159 | $ jmod --version 160 | ``` 161 | 162 | As output you should get something like this: 163 | 164 | ``` 165 | 10 166 | ``` 167 | 168 | 169 | ##### Alternative to keep JAVA\_HOME and PATH 170 | 171 | *NOTE*: Only for Linux and MacOSX users. 172 | 173 | If you don't like changing ```JAVA_HOME``` and ```PATH``` and you want to have an easy way to change your local Java version: 174 | 175 | - Keep your unzipped files in a single directory. For example: 176 | 177 | ``` 178 | $ pwd 179 | /usr/local/java 180 | 181 | $ ls -og 182 | total 12 183 | drwxr-xr-x 8 4096 sep 23 2016 jdk1.8.0_111 184 | drwxr-xr-x 8 4096 dic 13 2016 jdk1.8.0_121 185 | drwxr-xr-x 8 4096 ago 15 12:10 jdk-10+181 186 | ``` 187 | 188 | - Create a symbolic link ```jdk``` to desired JDK: 189 | 190 | ``` 191 | $ ln -s jdk-10+181 jdk 192 | 193 | $ ls -og 194 | total 12 195 | lrwxrwxrwx 1 12 abr 17 17:16 jdk -> jdk-10+181 196 | drwxr-xr-x 8 4096 sep 23 2016 jdk1.8.0_111 197 | drwxr-xr-x 8 4096 dic 13 2016 jdk1.8.0_121 198 | drwxr-xr-x 8 4096 ago 15 12:10 jdk-10+181 199 | ``` 200 | 201 | ```JAVA_HOME``` and ```PATH``` will use ```/usr/local/java/jdk``` forever. 202 | 203 | To change your local Java version, you only need to change the symbolic link. 204 | 205 | Now return to the [Download, install and verify JDK](./README.md#setup-all-platforms) section in the main [README.md](./README.md) file and continue with the rest of the steps. 206 | -------------------------------------------------------------------------------- /java10/setupEclipseOxygen.md: -------------------------------------------------------------------------------- 1 | ## Download, install and configure Eclipse Oxygen for JDK10 2 | 3 | ### Prerequisite 4 | 5 | Before installing Eclipse IDE please install JDK10 6 | 7 | #### Download Eclipse Oxygen 8 | 9 | The current version of the Eclipse IDE can be downloaded at [https://www.eclipse.org/downloads/](https://www.eclipse.org/downloads/). 10 | 11 | Depending on the OS a file **eclipse-inst-[mac/linux][64/32].tgz** (Linux/Mac OSX) or **eclipse-inst-[win][64/32].zip** will be downloaded. 12 | 13 | Please unpack that file and you will get an installer for the current eclipse version. 14 | 15 | #### Install 16 | 17 | Please Run the installer to get eclipse installed on your machine. 18 | 19 | #### Configure Eclipse for running with JDK10(ea) 20 | 21 | The Eclipse installer will automatically find the most current JDK version and configure the the Eclipse launcher to use it. 22 | 23 | Though Eclipse is not able to use JDK10 out of the box because of missing dependencies. 24 | 25 | To get Eclipse started, those missing dependencies (missing modules) have to be provided. 26 | 27 | This is done by adding the line: 28 | 29 | **--add-modules=java.se.ee** 30 | 31 | to the file **eclipse.ini** in the Eclipse installation. 32 | 33 | ##### Mac OSX 34 | 35 | The file **eclipse.ini** is located in the installed **eclipse.app** package. 36 | 37 | To change the content of the file browse to your installation folder 38 | 39 | **e.g.: /Applications/jee-oxygen/** and perform a right click on eclipse.app. 40 | 41 | In the popup menu choose **show package contents** and navigate to **./Contents/Eclipse**. 42 | 43 | Open eclipse.ini with your preferred text editor and add the line: 44 | 45 | **--add-modules=java.se.ee** 46 | 47 | to the end of the file (last line in **-vmargs** block). 48 | 49 | ##### Linux 50 | 51 | TBD 52 | 53 | #### Windows 54 | 55 | TBD 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /java10/setupTreeAndWget.md: -------------------------------------------------------------------------------- 1 | ### Download and install the `tree` and `wget` command 2 | 3 | Please install the ```tree``` command before moving forward: 4 | 5 | - Linux 6 | ``` 7 | sudo apt-get install tree 8 | sudo apt-get install wget 9 | ``` 10 | 11 | - MacOSX 12 | 13 | - Option 1: 14 | 15 | - install tree 16 | 17 | http://apple.stackexchange.com/questions/128876/whats-the-equivalent-of-the-unix-tree-command-on-osx 18 | 19 | - install wget 20 | 21 | http://stackoverflow.com/questions/4572153/os-x-equivalent-of-linuxs-wget 22 | 23 | - Option 2 (Via brew): 24 | 25 | `Comment from @Hilmerc as to why we are doing the below: Using MacOS Sierra 10.12.6, but we are not sure in which Mac version the brew command started to be necessary for the process.` 26 | 27 | You will need the latest version of brew. If you don't have brew installed, execute the next instruction or go [here](https://brew.sh/) for more information. 28 | 29 | - `ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` 30 | 31 | - `brew install tree` 32 | 33 | http://apple.stackexchange.com/questions/128876/whats-the-equivalent-of-the-unix-tree-command-on-osx 34 | 35 | - `brew install wget` 36 | 37 | http://stackoverflow.com/questions/4572153/os-x-equivalent-of-linuxs-wget 38 | 39 | 40 | - Windows 41 | ``` 42 | install `git-bash` (recommended) or `cgywin` 43 | ``` 44 | 45 | The `tree` command is built into Windows. From within `git-bash` or `cygwin`. 46 | In case a script is invoking the `tree` command and failing, please replace the `tree -fl` keywords with `cmd //c "tree /f /a"`. If that does not work either use `ls -R` instead, except you won't see the output in a tree format. 47 | 48 | Or manually convert the `.sh` files into `.bat`, with minor tweaks should also work there. 49 | 50 | Thanks Richard Kolb ([@rjdkolb](http://github.com/rjdkolb)) for your continued support in this area. 51 | 52 | Now return to the [Download and install tree and wget](./README.md#download-and-install-the-tree-and-wget-command) section in the main [README.md](./README.md) file and continue with the rest of the steps. 53 | -------------------------------------------------------------------------------- /java11/README.md: -------------------------------------------------------------------------------- 1 | # java11 2 | 3 | Java 11 project features --------------------------------------------------------------------------------