*I'd like to you acknowledge some help from Jenna Tarasova.*

I'm going to prove the contrapositive statement:

**(1)** If $J$ has height 2, then it contains an irreducible polynomial $f$.

To start with, I'm going to reduce to the case of monomial ideals. Specifically, I'm going to show that **(1)** is implied by:

**(2)** If $J$ is a height 2 monomial ideal and $w\in \Bbb N^2$ is generic, then $J$ contains an irreducible polynomial $f$ which is also $w$-homogeneous.

Recall that $w$-homogeneous (of degree $d$) means that $f(t^{w_1}X, t^{w_2}Y) = t^d f(X,Y)$ for all $t\neq0$; equivalently, each monomial in $f$ has the same $w$-degree, where the $w$-degree of $X^iY^j$ is defined to be $w_1i + w_2j$.

**Proof that (2) implies (1).** If $g$ is a nonzero polynomial, let $\operatorname{in}_w(g)$ denote its *initial form* with respect to the weight $w$. By definition, this means that if $g=\sum_{i,j} a_{ij} X^iY^j$ has $w$-order $d$ (i.e. $d = \max\{w_1i+w_2j : a_{ij}\neq 0\}$), then
$$\operatorname{in}_w(g) = \sum_{w_1i+w_2j=d} a_{ij} X^iY^j.$$
Define $\operatorname{in}_w(J) = (\operatorname{in}_w(g) : g\in J)$.

Basic Groebner basis theory implies that $\operatorname{in}_w(J)$ is a monomial ideal. Now use the following two facts (I encourage you to prove the second, also the first if you know Groebner basis things): (a) If $g\in \operatorname{in}_w(J)$ is $w$-homogeneous, then there exists an $f\in J$ with $\operatorname{in}_w(f) = g$; and (b) if $\operatorname{in}_w(f)$ is irreducible, then so is $f$. $\quad\Box$

Now that I've reduced us to **(2)**, I'm going to reduce things even further to the following statement:

**(3)** Let $n$ be a positive integer, and let $w\in \Bbb N^2$ be generic. Then the ideal $(X^n, Y^n)$ contains an irreducible polynomial $f$ which is also $w$-homogeneous.

**Proof that (3) implies (2).** It suffices to show that a height $2$ monomial ideal $J$ contains some $(X^n, Y^n)$. Choose a (monomial) generating set $m_1,\ldots,m_s$ of $J$. If every $m_i$ is divisible by $X$, then $J$ is contained in $(X)$ and therefore has height at most $1$, a contradiction. Therefore, at least one of $m_1,\ldots,m_s$ is not divisible by $X$. Similarly, at least one of them is not divisible by $Y$. In other words, since the $m_i$'s are all nonconstant monomials, $J$ contains $X^a$ and $Y^b$ for some positive integers $a,b$. Choosing $n\geq \max\{a,b\}$, we get that $J\ni X^n,Y^n$, as claimed. $\quad \Box$

Finally, let's prove **(3)**.

**Proof of (3).** Consider the $w$-homogeneous polynomial $f = X^{w_2} + Y^{w_1}$. By genericity, we may assume that $w_1,w_2\geq n$, so that $f\in J$. Also by genericity, we may assume that $w_1,w_2$ are distinct primes. (Suppose not. Then there exists a nonzero polynomial $g(x,y)\in \Bbb C[x,y]$ such that for all primes $p\neq q$, $g(p,q)=0$. Then every prime is a root of $(y-p)g(p,y)$, contradicting the fact that there are infinitely many primes.)

So I don't have to keep writing the subscripts, let's set $p=w_1$ and $q=w_2$, so that $f=X^q + Y^p$. This polynomial is irreducible: Thinking of $f$ as having coefficients in $\Bbb C(Y)$, let $t$ be a root of $f$ in some algebraic closure $K$ of $\Bbb C(Y)$. Then the roots of $f$ in $K$ are $t, \zeta t, \ldots, \zeta^{p-1} t$, where $\zeta$ is a primitive $p$th root of unity. But $\zeta\in \Bbb C\subseteq \Bbb C(Y)$, so for each $k=0,\ldots,p-1$, the map $\alpha \mapsto \zeta^k \alpha$ is an automorphism of the field extension $\Bbb C(Y)(t)/\Bbb C(Y)$ taking $t$ to $\zeta^k\alpha$. Thus, as $t$ is not itself in $\Bbb C(Y)$, we get that $f$ is irreducible (Dummit and Foote, Prop 14.2). $\quad \Box$

**Remark**

The same proof, with minor changes, works for the following generalization to any field and any number of variables:

**Theorem.** Let $k[X_1,\ldots,X_n]$ be a polynomial ring over a field $k$. If $J$ is a nonzero ideal in $k[X_1,\ldots,X_n]$ which contains no non-zero prime ideal, then $\operatorname{ht}J=1$.