JAVA LAB

Add to Favourites
Post to:

Description
In this presentation we will learn how to set environment variables like PATH,JAVA_HOME and CLASS PATH. In this presentation will learn how to run a JAVA program.


Type: ppt

Discussion

Ram Balram

https://www.manta.com/c/mh18gv9/mobile-app-development-company-in-new-york
https://www.manta.com/c/mh182p3/mobile-app-development-company-in-san-franciscoSee more

1493 days 13 hours 5 minutes ago

Presentation Transcript Presentation Transcript

PowerPoint Presentation :

PowerPoint Presentation :

PowerPoint Presentation : // A first program in Java to Display Welcome to Java Programming Source Code: public class Welcome1 { public static void main( String args[] ) { System.out.println ( "Welcome to Java Programming!" ); } } Out Put : Welcome to Java Programming! 1

PowerPoint Presentation : // A second program in Java to Display Welcome to Java Programming in multiple lines Source Code: public class Welcome2 { public static void main( String args[] ) { System.out.println ( "Welcome “); System.out.println (“ to “); System.out.println(“ Java Programming!" ); } } Out Put : Welcome to Java Programming! 2

PowerPoint Presentation : Environment Variables PATH CLASSPATH JAVA_HOME JAVA_HOME=C:\Program Files\Java\jdk1.7.0_03; PATH=C:\Program Files\Java\jdk1.7.0_03\bin; CLASS_PATH=C:\Program Files\Java\jdk1.7.0_03\lib;

PowerPoint Presentation : Environment Variable: PATH Setting Path on Windows : Windows 7 1. Select Computer from the Start menu 2. Choose System Properties from the context menu 3. Click Advanced system settings > Advanced tab 4. Click on Environment Variables, under System Variables, find PATH , and click on it. 5. In the Edit windows, modify PATH by adding the location of the class to the value for PATH . 6. If you do not have the item PATH , you may select to add a new variable and add PATH as the name and the location of the class as the value. 7.Reopen Command prompt window, and run your java code. PATH = C:\Program Files\ Java\jdk1.7.0_03\bin;

PowerPoint Presentation : How to set Environment Variable: PATH in Windows 7

PowerPoint Presentation :

PowerPoint Presentation :

PowerPoint Presentation :

PowerPoint Presentation :

PowerPoint Presentation : Environment Variable: CLASSPATH The CLASSPATH is an environment variable which is used by Java Virtual Machine to locate user defined classes. 1.Go to Environment variable window in Windows by pressing "Windows + Pause “-->Advanced -->Environment variable " or you can go from right click on my computer than choosing properties and then Advanced and then Environment variable this will open Environment variable window in windows. 2.Now specify your environment variable CLASSPATH and put the value of your JAVA_HOME\lib and also include current directory by including (dot or period sign). 3. Now to check the value of Java classpath in windows type "echo %CLASSPATH" in your DOS command prompt and it will show you the value of directory which are included in CLASSPATH CLASSPATH = C:\Program Files\ Java\jdk1.7.0_03\lib; .;

PowerPoint Presentation : You can override value of Java classpath defined by environment variable CLASSPATH by providing option "-cp" or "-classpath" while running your program and this is the best way to have different classpath for different application in Java. Overriding CLASSPATH in JAVA

PowerPoint Presentation : How to Set up the JAVA_HOME Environment Variable in Windows 1. Right-click on the My Computer icon on your desktop and then click Properties. 2. Click the Advanced tab. 3. Click Environment Variables. 4. Under System Variables, click New. 5. In the Variable name field, enter JAVA_HOME. 6. In the Variable value field, enter the installation path of the Java Development Kit. 7. Click OK. 8. Click Apply Changes.

PowerPoint Presentation :

PowerPoint Presentation : How to Compile your Java Program ?

PowerPoint Presentation : How to Run your Java Program ?

PowerPoint Presentation : import javax.swing.JOptionPane; public class Welcome4 { public static void main( String args[] ) { JOptionPane.showMessageDialog( null, "Welcome\ nto \ nJava \ nProgramming !" ); System.exit( 0 ); } } 3

PowerPoint Presentation : import javax.swing.JOptionPane; public class Addition { public static void main( String args[] ) { String firstNumber; String secondNumber; int number1; int number2; int sum; firstNumber = JOptionPane.showInputDialog( "Enter first integer" ); secondNumber = JOptionPane.showInputDialog( "Enter second integer" ); number1 = Integer.parseInt( firstNumber ); number2 = Integer.parseInt( secondNumber ); sum = number1 + number2; JOptionPane.showMessageDialog( null, "The sum is " + sum, "Results", JOptionPane.PLAIN_MESSAGE); System.exit( 0 ); } } 4

PowerPoint Presentation :

IT Expert
DBA Oracle Certified Professional , LINUX, C , C++,O/S ,NETWORKING, SE
User
65 Members Recommend
402 Followers

Your Facebook Friends on WizIQ