When annihilator of ideal and ideal is co maximal Let $R$ be a commutative ring with identity. It is not always true that ideal $J$ and annihilator of ideal $ann(J)$ are co maximal (ex: integral domain)

Is there a sufficient (necessary) condition( or ring) under which this happen $J$ and $ann(J)$ are comaximal?

 A: The necessary and sufficient condition is that $J$ be generated by an idempotent.
A. Assume $J=(e)$ is generated by an idempotent $e$ ($e^2=e$). Then the annihilator of $J$ contains $1-e$, so the sum of $J$ and its annihilator contains $e + (1-e)=1$. This shows that $J$ and its annihilator are comaximal.
B. Now suppose that the annihilator $K$ of $J$ is comaximal with $J$. That is, $J+K=R$. Then there exist $j\in J$ and $k\in K$ such that $j+k=1$. Multiplying through by $j$ one learns $j^2+jk = j^2 = j$, so $j\in J$ is an idempotent. Similarly, $k\in K$ is an idempotent. Since $J$ annihilates $K$, we have $kJ=0$, hence for $x\in J$ we have $x = x-0=x-kx = (1-k)x = jx$. We now have that $j\in J$ (i.e. $(j)\subseteq J$) and, for all $x\in J$ we have $x = jx$ (i.e. $J\subseteq (j)$), so we get that $J = (j)$. This shows that $J$ is generated by an idempotent.
August 3 Edit:
In response to the question below,
I wonder is this is a standard result (it seems to be a standard one)?
the answer is Yes, essentially. It is standard that the following are equivalent for unital rings:
(1) $J$ and $K$ are complementary ideals of $R$. $(J+K=R$, $J\cap K=(0))$
(2) $J$ is generated by a central idempotent $(J=(e))$ and $K$
is generated by the complementary idempotent $(K=(1-e))$.
(3) $R$ factors as $R\cong J\times K\cong R/ J\times R/K$.
Where does your condition fit into this picture? (Condition = $J$ is comaximal with its annihilator.)
It is a well-known fact that if $J$ and $K$ are comaximal, then their intersection equals their product. Therefore they are disjoint iff they annihilate each other. In particular, if $J$ annihilates $K$ and is comaximal with $K$, then $J$ is a complement to $K$.
Here is how you prove the well-known fact that if $J+K=R$, then
$J\cap K=JK$. It uses the fact that $JK\subseteq J\cap K$ for any two ideals.
$$
\underline{J\cap K}=R(J\cap K)=(J+K)(J\cap K)=J(J\cap K)+K(J\cap K)\subseteq \underline{JK}\subseteq \underline{J\cap K}.
$$
