Are the ranks equal? Let $A,B$ be invertible matrices of size $n$. Is $rk(AJJB)=rk(JBAJ)$, where $J$ is the Jordan block of size $n$ corresponding to $\lambda=0$?
 A: No. Let $A = B = \begin{pmatrix} a & b \\ c & d \end{pmatrix}, J = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}$
Then $JJ = 0$, so $AJJB = 0$.
On the other hand:
$$
AJ = \begin{pmatrix} 0 & a \\ 0 & c \end{pmatrix}\\
JB = \begin{pmatrix} c & d \\ 0 & 0 \end{pmatrix}\\
JBAJ = \begin{pmatrix} 0 & c(a + d) \\ 0 & 0 \end{pmatrix}
$$
so, just choose $a,b,c,d$ so that $A$ is invertible and $c(a + d) \neq 0$ ($a = c = d, b = 0$ will work)
For $n > 2$, as you note, it is no longer true that $J^2 = 0$, however there are still counterexamples. I don't have a proof that, for arbitrary $n > 2$, there will be a counterexample, but I don't think that they should be hard to produce, in the sense that, if you take randomly-chosen, invertible $A$ and $B$, $JBAJ$ probably has rank higher than $AJJB$.
For instance, I had matlab produce two random $3\times 3$ matrices
$$
A = \begin{pmatrix} 0.7657&    0.8602&    0.2439\\
    0.5229&    0.7334&    0.1389\\
    0.4325&    0.3921&    0.9377
\end{pmatrix};\quad
B = \begin{pmatrix}
 0.0767&    0.0802&    0.2505\\
    0.1405&    0.1253&    0.3527\\
    0.6308&    0.8728&    0.5173
\end{pmatrix}
$$
and of course
$$
J = \begin{pmatrix}
 0&    1&    0\\
    0&    0&    1\\
    0&    0&    0
\end{pmatrix}
$$
and checked that rank of $A$ and $B$ are both $3$.
Then, I checked

>> rank(A*J*J*B)
ans = 1

>> rank(J*B*A*J)
ans = 2


I tried this with several other randomly generated $A$ and $B$ and the results were the same.
