How to download and install Java 8.

Following are steps to install Java in Windows

1) Go to Oracle website and Download JDK.For java latestVersion

  1. Goto Java SE download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html.


  2. Under "Java Platform, Standard Edition"? " Java SE 8u", Click the "JDK Download" button.
  3. Look for the latest "Java SE Development Kit 8u"? Check "Accept License Agreement".
  4. Choose the JDK for your operating system, e.g., "Windows x64" (for 64-bit Windows OS) or "Windows x86" (for 32-bit Windows OS). You can check whether your Windows OS is 32-bit or 64-bit via "Control Panel"? (Optional) System and Security? System ? Under "System Type".


  5. Once the download is complete, run the eye for install jdk . Click Next,



  6. Once install is complete click Close.


2) Installation of eclipse IDE

So far, you've configured your environment, installed the Atlassian SDK, and created a HelloWorld plugin project. You've tweaked the plugin project a bit but it has no modules so other than live in the UPM, it does nothing. Of course, you've done all this on the command line - most programmers prefer the advantages of an IDE. So, on this page, you configure the Eclipse IDE to work with the SDK, import HelloWorld and add some functionality.

  1. Install the Eclipse IDE.
  2. Start Eclipse and update the Installed JREs.
  3. Install the Maven Eclipse Plugin.
  4. Configure the Maven Plugin.
  5. The Next Steps

    Step 1: Install the Eclipse IDE

    In this step, you download and install the Eclipse IDE for Java EE Developers (Indigo). This version of Eclipse comes with most of the Maven dependencies already installed. Do the following to install Eclipse in your system: Download the Eclpse IDE for Java EE developers. This IDE has many of the dependencies required by the Maven Eclipse plugin. The Maven Plugin to be downloaded is not compatible with Eclipse Kepler or Indigo, so download the Luna edition. Move the tar file into your home directory. Expand the tar file.

    tar -xvzf eclipse-standard-luna-R-macosx-cocoa-x86_64.tar.gz

    When you are done, you will have an eclipse directory in your home directory.

    Step 2: Start Eclipse and update the Installed JREs

    Now you are ready to start Eclipse.

    1. Change directory to ~/eclipse.

    2. Run the Eclipse program by typing:

    . / eclipse

    Eclipse prompts you to identify the location of your workspace.

    3. Enter the location of the atlas tutorial directory.




    4. Open the Eclipse > Preferences dialog.

    5. Filter for or navigate to the Installed JREs page.

    6. Make sure that the checked JRE comes from the JDK 1.6.

    Step 3: Install the Maven Eclipse Plugin

    Start Eclipse and do the following:

    1. Choose Help > Install New Software from the menu bar. The Available Software dialog appears.

    2. Click the Add button. The Add Repository dialog appears.

    3. Enter Sonatype M2Eclipse in the Name field.

    4. Enter http://download.eclipse.org/technology/m2e/releases in the Location in the field.

    5. Press OK to close the dialog. The system searches the site for the plugin. After a moment, the Name field fills with the Maven Integration for Eclipse.

    6. Check the box and press Next.

    7. Select the Maven Integration for Eclipse.

    8. Press Next and Next again.

    9. Accept the terms of the license agreement and press Finish. Eclipse calculates the dependencies and space

    10. Press Next.

    11. Accept the License agreement and press Next

    12. Press Finish. The installation procedure runs.

    13. Restart Eclipse when prompted.

    Step 4: Configure the Maven Plugin

    After Eclipse has restarted, configure it to use the Maven Eclipse plugin you just installed.

    1. Choose Window > Preferences from the Eclipse menu bar. The system displays the preferences dialog.

    2. Filter for or navigate to the Maven > Installations page.

    3. Click the Add button. The Maven Installation dialog displays.

    4. Browse to your /usr/share/atlassian-plugin-sdk-/apache-maven installation.

    5. Press OK. The system sets this external repository for you. The dialog should look like the following:



    6. Ensure the Global settings are coming from the installation directory.

    7. Press Apply.

    8. Click the Maven root.

    9. Uncheck Download repository index updates on startup. This prevents Maven from updating on Eclipse start up, which can be time-consuming. The atlas- commands update the repositories for you.

    10. Press OK to close the dialog.

    The Next Steps

    You've got Eclipse set up and configured. Now, you can import your project into Eclipse and use the Atlassian SDK with it.

    3. Setting path for JAVA HOME

    1. Right click My Computer and select Properties > Advanced System Settings.
    2. Click the Environment Variables button.
    3. Under System Variables, click New.
    4. In the Variable Name field, enter either.
    5. If the latest version on Java website is 1.8.0_65, your class path will be C:\Program Files\Java\jdk1.8.0_65\bin; copy at Variable value place and variable name place type path.



    6. Restart your PC. Go to command prompt and type javac.

    If you see a screen like below' Java is installed.



    Run a java program from command Prompt.

    This instructable will teach you how to:

    1. Install the Java Development Kit.

    2. Set system variables to easily be able to compile and execute java files.

    3. Compile and execute a Java file from Command Prompt.

    Step 1: Download Latest JDK


    1. Follow this link: http://www.oracle.com/technetwork/java/javase/downloads/index.html
    2. Click Download JDK under the download Java Standard Edition panel.
    3. Choose your Operating System and agree to the terms of service. **
    4. ** This will probably be Windows since your using Command Prompt.

    Step 2: Setting Path for Command Prompt






    1. Open the Command Prompt.
    2. Type "set Path=C:\Program Files\Javajdk1.8.0_121\bin" .*
    3. Type " set HomePath= C:\Program Files\Java\ jdk1.8.0_121 *

    * If you have a later JDK ( i.e. JDK 1.6.0_22) replace the portion that says jdk1.6.0 with it.
    ** If you don't know which jdk you have to go to start pane( at bottom left corner of your screen)>click run> click browse>Then  go to C:\Program Files\Java.
    *** Do not type quotation marks in steps 1-3  at the command prompt.

    Step 3: Creating a Simple Java Program




    1. Create Program
    2. Go to Start pane>All Programs > Accessories> Notepad.exe
    3. Copy and paste the following exactly:

    public class helloworld
    {
    public static void main(String[] args)
    {
    	System.out.println("Hello World!");
    }
    }
    		

    Save the file as helloworld.java

    Make sure "Save as type" under where you typed the file name as "All Files" (as opposed to the default "Text-File").

    You want to save your java file where the Command Prompt is set to open at.*

    *Such as C:\Users\Home

    Step 4: Compiling and Executing the Program




    1. First compile file by going to Command Prompt and typing javac helloworld.java.
    2. This will create a class file which you can execute by typing java helloworld.
    3. It should print "Hello World!" to show your done.

    7. Type Conversion, Type Casting

    Summary: By the end of this tutorial "Java Data Type Casting Type Conversion", you will be comfortable with converting one data type to another either implicitly or explicitly. Java supports two types of castings – primitive data type casting and reference type casting. Reference type casting is nothing but assigning one Java object to another object. It comes with very strict rules and is explained clearly in Object Casting. Now let us go for data type casting.

    Java data type casting comes with 3 flavors.

    1. Implicit casting.
    2. Explicit casting.
    3. Boolean casting.

    1. Implicit casting(widening conversion)

    A data type of lower size (occupying less memory) is assigned to a data type of higher size. This is done implicitly by the JVM. The lower size is widened to higher size. This is also named as automatic type conversion.

    int x = 30;                    // occupies 4 bytes
    double y = x;                  // occupies 8 bytes
    System.out.println(y);         // prints 10.0

    In the above code 4 bytes integer value is assigned to 8 bytes double value.

    2. Explicit casting (narrowing conversion)

    A data type of higher size (occupying more memory) cannot be assigned to a data type of lower size. This is not done implicitly by the JVM and requires explicit casting; a casting operation to be performed by the programmer. The higher size is narrowed to lower size.

    double x = 30.5;             // 8 bytes
     int y = x;                   // 4 bytes ;  raises compilation error
    

    In the above code, 8 bytes double value is narrowed to 4 bytes int value. It raises error. Let us explicitly type cast it.

    double x = 30.5;                  
    int y = (int) x; 

    The double x is explicitly converted to int y. The thumb rule is, on both sides, the same data type should exist.

    3. Boolean casting

    A boolean value cannot be assigned to any other data type. Except boolean, all the remaining 7 data types can be assigned to one another either implicitly or explicitly; but boolean cannot. We say, boolean is incompatible for conversion. Maximum we can assign a boolean value to another boolean.

    Following raises error.

    boolean x = true;
    int y = x;                    // error
    boolean x = true;
    int y = (int) x;           // error
    


    In the above statement, left to right can be assigned implicitly and right to left requires explicit casting. That is, byte can be assigned to short implicitly but short to byte requires explicit casting. Following char operations are possible

    public ClassDemo1
    {
     public static void main(String args[]) 
    	{
    	char ch1 = 'A';
    	double d1 = ch1;
    	System.out.println(d1);        // prints 65.0
    	System.out.println(ch1 * ch1);  // prints 4225 , 65 * 65
    	double d2 = 66.0;
    	char ch2 = (char) d2;
    	System.out.println(ch2);      // prints B
    }
    }

    All the data type conversions

    byte TO short int long float double char boolean
    short TO byte int long float double char boolean
    int TO byte short long float doublechar boolean
    float TO byte short int long double char boolean
    double TO byte short int long float char boolean
    char TO byte short int long float double boolean
    boolean TO byte short int long float ouble char

    String and data type conversions

    String TO byte short int long float double char boolean
    byte short int long float double char boolean TO String