Application queries are not getting generated in trace file in oracle I am getting queries in trace file which are fired from Oracle SQL Developer IDE but I want to trace queries on Oracle database, which got fired from my java application.

I'm using ALTER SESSION SET SQL_TRACE = TRUE; command and using tkprof utility.
There are a couple of ways of starting a trace in another session.

You can either use a login trigger that sets tracing in the session when it first logs on:

CREATE OR REPLACE TRIGGER TRACE_MY_JAVA
AFTER LOGON ON DATABASE
BEGIN
    IF USER = 'MYJAVAUSER' -- edit this condition to pick out your Java sessions
  THEN
    execute immediate 'alter session set events ''10046 trace name context forever, level 12''';
  END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
/


Or, if the session has already started, you can use dbms_system.set_sql_trace_in_session. Get the other session from v$session:

SELECT sid, serial#
FROM v$session
WHERE -- whatever you need to identify your Java application;


Then execute the proc:

execute dbms_system.set_sql_trace_in_session (sid, serial#, TRUE);


(Add the sid and serial# from the above query)