Powered by Blogger.
RSS

How To Create a Java Application Using Notepad


The java application we are going to create is called a Hello World app and this app will simply display the greeting "Hello World!".

Practically almost all tutorials on java and beginner programmers have you to create this simple app as your first application, so you don't have to know something about java programming to be able to create this app.



In order to create this application, you'll need: The Java SE Development Kit 7 (JDK 7) and a text editor. In this case, we'll use Notepad, a simple editor included with the Windows platforms. These two items are all you'll need to write your first application.

Create a Source File

 First, start your editor. You can launch the Notepad editor from the Start menu by selecting Programs > Accessories > Notepad. In a new document, type in the following code:

/**
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}


JAVA SYNTAX - Note: Type all code, commands, and file names exactly as shown. Both the compiler (javac) and launcher (java) are case-sensitive, so you must capitalize consistently.

HelloWorldApp is not the same as helloworldapp.

Save the code in a file with the name HelloWorldApp.java. To do this in Notepad, first choose the File > Save As menu item. Then, in the Save As dialog box: 

  1. Using the Save in combo box, specify the folder (directory) where you'll save your file. In this example, the directory is java on the C drive.
  2. In the File name text field, type "HelloWorldApp.java", including the quotation marks.
  3. From the Save as type combo box, choose Text Documents (*.txt).
  4. In the Encoding combo box, leave the encoding as ANSI.
When you're finished, the dialog box should look like this.
 The Save As dialog just before you click Save.

Compile the Source File into a .class File

Open a shell, or "command," window. You can do this from the Start menu by choosing Command Prompt (Windows XP), or by clicking the Start menu ... and then entering cmd. The shell window should look similar to the following figure.
A command prompt window
The prompt shows your current directory. When you bring up the prompt, your current directory is usually your home directory as shown in the preceding figure.

To compile your source file, change your current directory to the directory where your file is located. For example, if your source directory is java on the C drive, type the following command at the prompt and press Enter:

cd C:\java
Now the prompt should change to C:\java>.
 

If you enter dir at the prompt, you should see your source file, as the following figure shows.
Directory listing showing the .java source file.

 Now you are ready to compile. At the prompt, type the following command and press Enter.

            javac HelloWorldApp.java

The compiler has generated a bytecode file, HelloWorldApp.class. At the prompt, type dir to see the new file that was generated, as shown in the following figure.
Directory listing, showing the generated .class file

Now that you have a .class file, you can run your program.

Run the Program

In the same directory, enter the following command at the prompt:

        java HelloWorldApp
The next figure shows what you should now see:










The program prints "Hello World!" to the screen.

Yes! you've done it. Well done! If you have any problems please do not hesitate to use the comment box.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

How To Turn On/Off Hibernate on Windows OS


Having problems with hibernate? Some windows OS have the hibernate function turned off, so you might be wondering if your system have a problem when you don't see the hibernate option. But be rest assured all you need to do is to turn it on and I will show you how through the command prompt.



Steps
    1. Using your mouse, navigate to the start menu at the bottom left corner of your screen or press the windows button on your keyboard.

     
           2.  Type cmd (command prompt) on the search bar. 

           3.  Right click the first option cmd and click on the Run as administrator.

         
              4.  A user account control security alert will pop up, click on Yes to accept. 

              5.  Type in the command prompt powercfg hibernate on then press enter.

             

                   6.  Close the window and check your hibernate option.

              • Digg
              • Del.icio.us
              • StumbleUpon
              • Reddit
              • RSS

              Get An Email ID That Lasts For Only 10 Minutes

              Why do I need a disposable 10 mins email id is the question that must be running through your mind, well guess what? Because there are some sites that only allow you to download contents or access there other pages only if you register with your email address and mind you, some of these sites are the cause of mail spam today.


              So in order to solve this, a 10minute mail is an incredible way out.

              How To...
              1. Visit the website - 10minutemail.com
              2. Copy the email id
              3. Paste it @ the email id textbox
              4. tada... you are done
              Pros
              1. Create an email id which expires in 10 minutes
              2. Used at sites where compulsory registration is required
              3. Help get rid of spam mails
              Cons
              1. You cannot send mail from this email id
              2. Emails can only be read withing the 10 minutes expiration time

              • Digg
              • Del.icio.us
              • StumbleUpon
              • Reddit
              • RSS

              How To Switch Through Open Applications Using The Keyboard

              The keyboard shortcut used to switch between open apps on Windows OS is Alt + Tab. But there is more to just pressing Alt + Tab to switch between windows. There are a variety of hidden keyboard shortcuts that make the Alt+Tab switcher quicker and easier to use.

              If you’re like most people, you probably just press Alt+Tab and continue pressing the Tab key until you reach the window you want. If you’re using Alt+Tab in this way, you’re missing out on a lot of useful keyboard shortcuts and other tricks that can save you time. I will briefly highlight some of these shortcuts so that you try them yourself.


              • Use The Arrow Keys: Press the arrow keys while the Alt+Tab switcher is available to easily select the window you want. Selecting a window will make it visible, so you can easily find the window you want. Release the Alt key or press Enter to switch to the selected window.

              • Alt+Tab in Reverse:  If you’re pressing Alt+Tab and accidentally go past the window you want to select, you don’t have to press the Tab key repeatedly to cycle through all open windows. Use the Alt+Shift+Tab keyboard shortcut to select windows in reverse order.

              • Use The Mouse:  The Alt+Tab switcher can also be used with a mouse. Just click one of the thumbnails with your mouse to activate the window. Hovering over a thumbnail will make the window visible.

              • Use Alt+Tab Without Holding The Alt Key Down: To use Alt+Tab without holding the Alt key down the entire time, press the Alt+Ctrl+Tab keys at the same time. You can then release all the keys and the Alt+Tab switcher will remain visible. Use the arrow keys and Enter key or the mouse to select your desired window.

              • Close the Alt+Tab Switcher: You can press the Escape key to close the Alt+Tab switcher without switching to another window. This can be more convenient than hunting down the window you started with if you decide you don’t want to switch windows.
               Do you use any other hidden keyboard shortcut other than the ones mentioned above? Leave a comment and share them!

              • Digg
              • Del.icio.us
              • StumbleUpon
              • Reddit
              • RSS

              How To Configure MTN, GLO, Airtel & Etisalat Internet Settings On Your Mobile Phone



              To enjoy internet services on your mobile phone, it is quite essential for you to configure your mobile phone with the internet settings of the mobile network you wish to be surfing with. Before you can browse the internet, your phone, must at least be WAP ENABLED. If you check through the MENU of your phone and you see a WEB or WAP browser, then you should be able to surf the internet with it.


              You can configure your mobile phone by texting SMScommand to a special number provided by the operator you want to use in connecting to the internet. If your phone can be configured automatically, within a few minutes of sending the text message, you will receive messages from the operator which will contain the internet settings. All you just have to do is to SAVE the settings.

              If your phone cannot be automatically configured, the operator will notify you through a text message. In this case, you will have to configure your phone manually. If you cannot configure it manually, you can either call the customer care of your operator or you visit the nearby office of the operator and it will be done for you. The different ways to activate and manually configure your mobile phone to surf the internet using MTN, GLO, Airtel  and ETISALAT NIGERIA are highlighted below.
              MTN Internet Configuration Settings
              To receive automatic internet settings send text message in this format: SETTINGS to 3888
              you will receive settings in less than a minute, save it and you are set to start browsing the internet.
              or you can use this manual configuration
              Account Name: MTN
              Homepage: http://wap.mtnonline.com
              Username: web
              Password: web
              Access Point or APN: web.gprs.mtnnigeria.net
              IP or Proxy Address: 010.199.212.002
              Port: 8080
              GLO Internet Configuration Settings
              You can receive GLO internet settings to your mobile phone by sending your phone make and model to 927. Example Nokia 7610 to 927
              or you can configure your phone manually with the settings below:
              Account Name: GLO
              Homepage: http://wap.gloworld.com
              Username: wap
              Password: wap
              Access Point or APN: glosecure
              IP or Proxy Address: 010.100.098.022
              Port: 8080
              Airtel Internet Configuration Settings
              You will still need to send internet to 232 to activate full internet access on your device.
              or use the manual settings below:
              Account Name: AIRTEL
              Homepage: http://wap.ng.airtel.com
              Username: Internet
              Password: Internet
              Access Point or APN: internet.ng.zain.com
              IP or Proxy Address: 172.018.254.005
              Port: 8080
              Etisalat Internet Configuration Settings
              Account Name: ETISALAT
              Homepage: http://www.etisalat.com.ng OR http://mobile.etisalat.com.ng
              Username: wap
              Password: wap
              Access Point or APN: etisalat
              IP or Proxy Address: 010.071.170.005
              Port: 8080
              If you have not been surfing the internet with your WAP-enabled phone, then you have been missing a lot. Configure your phone now and give it a try. With mobile internet, you can always check/send emails, update your facebook and twitter etc while on the GO. If you are already enjoying any or all of these services, then make a comment below expressing how you feel about them.


              • Digg
              • Del.icio.us
              • StumbleUpon
              • Reddit
              • RSS