fbpx

How to create a file in unix – 3Minutes: Tutorial

In this video, I have explained How to create a file in unix?

(Create, edit, view and save text file using unix terminal.)

This video covers the below listed commands

  1. pwd – present working directory
  2. cd – change directory
  3. touch – to create file
  4. cat – view content of the file
  5. less – same as cat command, but opens in editor
  6. mkdir – make or create directory
https://youtu.be/xDe6OLATxQc

How to create a file in unix ?

[email protected]:~/dev/folder1$ touch hello.txt
[email protected]:~/dev/folder1$ vi hello.txt
[Edit the file] to save press Esc + :wq (w is for save and q is for quit)
[email protected]:~/dev/folder1$ cat hello.txt

Keep the learning short, not to waste your precious time.

How to create a file in unix - 3Minutes: Tutorial

Hello World!! Apache Wicket

What is Apache Wicket ?

Apache Wicket is a Web Framework provided by Apache Foundation “apache.org“.

Why Apache Wicket?

To my understanding, Apache wicket is a Component based web framework. Which provides support to create the View and Model (UI and Business Logic) very quickly and easily.

What do we need to create Wicket Application?

In order for us to build Wicket Application, we need the Libraries and IDEs.

  • Wicket Libraries – Download (at the time of writing this blog i used the Apache Wicket 7.x)
  • Eclipse IDE J2EE/WDT – Download
  • m2e – maven2 for Eclipse Plugin – How to download m2e from market place?
  • Tomcat 7 (We need a web server, to run our application to handle the Servlet/Filter Request & Response)

Note: If you are using maven to configure the project, you do not need to download the wicket libraries mentioned above, because maven will download the necessary jars required for Wicket Application.


Lets Get Start With Setting up the Workspace!!

  • Launch Eclipse
  • Create New Dynamic Web Project (New -> Project -> Other – Dynamic Web Project)
  • Give Project a Name “WicketHelloWorld”
  • Choose the Runtime and Select Apache Tomcat 7.0 (How to Setup Apache Tomcat 7 Server)
  • Click Next

    new-project

    New Dynamic Web Project

  • Do not change anything for the class source directory, Click Next

    src-classes

    No Changes, Click next

  • Make Sure you Click the Check Box “Generate web.xml”. !

    webxml

    Select Generate web.xml

  • Click Finish.
  • Your project will be created and can be seen in project explorer.

Adding Maven Dependency to the Project we created.

  • We need to add Maven Dependency to the project.
  • Right Click on the Project and Choose “Configure -> Convert to Maven Project”.

    maven-convert-project

    Groupid : your package name can be given Artifact id: Your Project Name packaging: war (Web archive)

  • Click Finish, pom file will be opened.

pom-file

pom.xml

  • We need to add the dependency for Wicket and other required libraries.
  • Click on the pom.xml tab and add the below dependency entry
      
         org.apache.wicket
         wicket
         7.7.0
         pom
      

add this into pom.xml after closing tag. and save the pom.

  • Press Alt+F5 to update the Maven dependency

    Note: You need Internet connection at very first to download the wicket library files.

  • Once your have the maven dependency downloaded, we are good to start creating our Wicket Hello World!! Program.
  • Open web.xml from WebContent/WEB-INF/web.xml

 WicketHelloWorld

 WicketFlowApp
 org.apache.wicket.protocol.http.WicketFilter
 
 applicationClassName
 in.co.aryanz.app.MainApplication
 
 
 
 WicketFlowApp
 /*
 

We have to add Filter to the web.xml, so that when we hit the URL in browser it uses the wicket filter to kick-start our application.

  • Now create new java package “in.balamt.app”
  • Create new Java Class “MainApplication.java” which extends from “org.apache.wicket.protocol.http.WebApplication”.
package in.balamt.app;

import org.apache.wicket.Page;
import org.apache.wicket.protocol.http.WebApplication;

public class MainApplication extends WebApplication {

 @Override
 public Class getHomePage() {
 // This getHomePage method will be called at first, and inorder to have our HomePage to be displayed we give the HomePage.class
 return HomePage.class;
 }

}

MainApplication.java

  • getHomePage() method is called when launching the application. so we have to provide the home page.
  • Create new package “in.balamt.pages”
  • Create New Java Class “HomePage.java” and Create New HTML “HomePage.html”

    Note: Wicket required both java and html files, also both the files need to be placed together, meaning java and html file name and location should be same.

    To be continued

How to Setup Apache Tomcat 7 Server

Setting Up Apache Tomcat 6/7/8 Server Runtime


At first we need to download install Apache Tomcat 7.

  • After Install, Open Eclipse.
  • Open Windows -> Preference and Search for “Server”

    Preference for Server

    Windows -> Preference -> Server

  • Select Runtime Environments, Click Add.
  • New Server Runtime Wizard will open.
  • Select The Apache Tomcat Version (Here i’m Selecting Tomcat 7)

runtim-select-tcat7

New Server Runtime Environment (Select Tomcat 7 or other Version)

  • Click Next
  • Name (Can be any name)
    • Apache Tomcat 7.0
  • Tomcat Installation Directory (Choose the Installation Dir)
    • C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
  • JRE
    • Select the Workbench Default (if you want to use different JRE, change here).
  • Click Finish.

We Have Create new Runtime.

Now we need to Create Local Server

  • Windows -> Show View -> Server (Alternatevely you can User Quick Access to open Server view).
  • Create New Server

    new-server

    New Server :  Click Finish to Have default Values

     

  • Voila! We have finished the Server Setup.
  • You can startt adding the project to server and Start.

How-To Choose Right Version of Eclipse For you!!

Choose the Right Version of Eclipse & Download


To Download Eclipse visit http://www.eclipse.org/downloads/eclipse-packages/

Below are few List of Eclipse Packages

Eclipse Download Packages List

Eclipse Download Packages List

Choose the one you are looking for.

For example if you want to develop Java/J2EE Applications Download –

Choose 32 bit or 64 bit (See How to Check Your PC is 32 bit or 64 bit ?)

Eclipse for Java/J2EE Dev

Eclipse for Java/J2EE Dev

Now Download the .zip package (for Windows) and .tar.gz (for Linux & MacOS)

See How to Install Eclipse ?

How-To : Install Eclipse IDE

Installing Eclipse


See How to Download Eclipse

If you have Downloaded the Eclipse for Windows (.zip file)

  • After Downloading the .zip file from Eclipse
  • Open your “C Drive” or other Drive with 2+ GB Free Space.
  • Create New Folder eclipse.
  • copy the zip file to C:\eclipse\
  • Right click the zip file and Choose Extraxt All.
  • In the extract folder path, Browse to the location C:\ (While Extracting the zip will create another Folder named eclipse)
  • Click Extract to extract the files.
  • Voila!! You have installed the Eclipse. Yeah i know this is so simple!!

Place Short Cut in Desktop:

  • Right Click on eclipse.exe inside the C:\eclipse\eclipse.exe
  • Click Sent to Desktop to create shortcut
  • Now double click to launch the Eclipse.