Loading
Unix Interview Questions

Java Quick Notes

Refresh Your Java

We are Agile, believe in less Documentation - Only Quick notes of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

"Click on other Tabs for more Questions"  

"Unix "


Unix/Linux/Solaris Cmds which may be required in your day to day development

1 )   What is Thread Dump?, How to Take Thread Dump in Unix , Linux, Solaris, Windows?


Ans)


  • Thread Dump
    Sample Img 1

Thread Dump is nothing but a snap shot of your JVM process at a Given Point of Time.
Usually we take Thread Dump to pinpoint the issue (identifying the root cause) when the
Application hung or unresponsive or the performance of the application is unexpectedly low.
Thread Dump provides you the list of Threads with a stacktarce of operations currently
they are performing.

Should do the following to capture the Thread Dump:

Unix:
Find process id as follows
             ps -ef | grep java
 Perform Kill -3 on java process.
            Kill -3 <java process id>

Windows:
      Press ctrl+break



Back to top

2 )    How to find the Java Process Id in Unix ?


Ans)

You may need to find the Java Process Id in Server Box for taking Thread Dump or
restarting the App Server without using Stop server script.

Simply use ps command to get the process id as follows:

ps aux | grep Java

Or

ps -ef | grep java

 



Back to top

3 )   Tail the Log Files ?


Ans)

To tail the logs in Unix or Linux please use the following command. The following
command prints the last 1000 lines of the given log file.

Tail -1000f  test.log



Back to top

4 )   Search For a String in all the Folder ?


Ans)

find . -type f -exec grep -l "yourword" {} +

Or
 
find . -exec grep "yourword" '{}' \; -print

Or
 
find /path/to/dir -type f | xargs grep -l "yourword"



Back to top

5 )   How to use SUDO in unix ?


Ans)

sudo -u druser -s



Back to top

6 )   How to Check the Disk Space in Unix Or Linux ?


Ans)

df - k



Back to top

7 )   Delete cmd


Ans)

Removing the Dir

rm -rf    temp  

 

 



Back to top

8 )   Check file permissions


Ans)

ls -lrt

Output would looks like this.

drwxr-xr-x 3 testfile writers 80 2005-09-22 21:40 dir



Back to top

9 )   Change the Permissions


Ans)

chmod a=r testfile 



Back to top

10 )   Kill Java (Weblogic or Tomcast) Process Id ?


Ans)

There are so many instances you may want to Kill the Java Process for restarting the Servers.

Step 1:

ps -ef | grep java

Step 2:

kill -9 <process id>

 



Back to top

11 )   Sample Shell Script To Run Java Class


Ans)

This is sample Shell Script gives us an idea on how to write a
Shell Script to Run a Java Class which could be a Batch Job.

YOURAPP_LIB_HOME=$HOME/lib
JDBC_LIB=/export/apps/oracli/cust/10.1.0.3/jdbc/lib
JAVA_HOME=/export/appl/gt-tools/j2sdk1.4.2_12

export YOURAPP_LIB_HOME JDBC_LIB JAVA_HOME
PATH=/usr/SYSADM/bin:/usr/sbin:.:/export/apps/sched/autosys/bin:/export/apps/sched/local/bin:
/export/apps/sched/local/sbin:/export/apps/sched/local/arch/bin:/export/apps/sched/local/arch/sbin:/usr/SYSADM/bin:/export/appl:$JAVA_HOME/bin

CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar:$YOURAPP_LIB_HOME/activation.jar:$YOURAPP_LIB_HOME/mail.jar:$HOME/bin:$JDBC_LIB/classes12.jar
export PATH CLASSPATH
echo $PATH
echo $CLASSPATH
java com.salesorder.batchjob.DataSync

public class DataSync {

}

 



Back to top

12 )   Shell Script to Run a SQL Script


Ans)

This is sample Shell Script gives us an idea on how to write a
Shell Script to Run a SQL Script.

Please examples meant for giving an idea , you need to customize these
your needs.

RunSQL.sh:

 setenv ORACLE_HOME /export/apps/oracli/cust/10.1.0.3
 setenv TNS_ADMIN /export/apps/oracli/cust/admin/network
 setenv PATH /export/apps/oracli/cust/10.1.0.3/bin:${PATH}
 setenv  LD_LIBRARY_PATH /export/apps/oracli/cust/10.1.0.3/lib

sqlplus @[DB_USER]@@[DB_INSTANCE_NAME]/@[DB_PWD] @$HOME/bin/ProductLoad.sql

 ProductLoad.sql :

delete "SalesOrder"."SELR_SRVR";

insert into  "SalesOrder"."SELR_SRVR"
select unique PRODUCT_ID, PRODUCT_NME,NVL(SUBSTR(ENTY_NO,1,5),PRODUCT_ID),NVL(ENTY_NME,SUBSTR(PRODUCT_NME,1,60)),
PRNT_SELR_STAT,PRNT_SRVR_STAT  from SalesOrder.X_SELR_SRVR_STGG
where PRNT_SELR_STAT = 3 or "PRNT_SRVR_STAT" = 5;

exit



Back to top

13 )   Sample AUTOSYS jil file


Ans)

Sample AUTOSYS jil file

This is a sample AUTOSYS file gives us an idea on how to write a
AUTOSYS .jil

Please examples meant for giving an idea , you need to customize these
your needs.

Assume that you have ProductLoad.sh which loads that product data into your
Application DB and that should be run everyday at 5:00 AM

------------------------------------------------------------------------

delete_box:       appDev#box#ProductLoad

insert_job:       appDev#box#ProductLoad
job_type:         box
description:      Run Product Load Box
owner:            @[DB_USER]
machine:          @[AUTOSYS_SERVER]
permission:       gx,wx
date_conditions:  yes
days_of_week:     all
start_times:      "05:00"
condition:        notrunning(appDev#box#ProductLoad)

      insert_job:       appDev#cmd#ProductLoad
      job_type:         command
      description:      Run ProductLoad Script
      box_name:         appDev#box#ProductLoad
      owner:            @[DB_USER]
      machine:          @[AUTOSYS_SERVER]
      permission:       gx,wx
      command:          /appl/bin/appDev_ProductLoad.sh
      std_out_file:     /appl/log/appDev#box#ProductLoad.out
      std_err_file:     /appl/log/appDev#box#ProductLoad.err
      min_run_alarm:    0
      max_run_alarm:    30
      job_terminator:   yes
      box_terminator:   yes

update_job:   appDev#box#ProductLoad
box_success: success(appDev#cmd#ProductLoad)

---------------------------------------------------------------



Back to top

This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,

This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.




Face Book

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free

Go To Site Map