Quotient of free module 
Let $R$ be a commutative ring with $1$ and let $J$ be a proper ideal of $R$ such that $R/J \cong R^n$ as $R$-modules where $n$ is some natural number. Does this imply that $J$ is the trivial ideal?

Basically I am trying to prove/disprove that if $J$ is a proper ideal of $R$ and $R/J$ is free then $J=0$ and above is my work.
 A: You have an epi $f:R\to R^n$. Tensoring it with $k=R/\mathfrak m$ for some maximal ideal $\mathfrak m\subset R$, we get an epi $k\to k^n$, so $n$ must be equal to $1$. Now the short exact sequence $$0\to J\to R\xrightarrow{\;f\;} R\to 0$$ must split, because the rightmost $R$ is projective. 
Can you see how to finish this?
A: Here is my original answer:

No; let $R=k[x_1,x_2,\ldots]$ for any field $k$ (a polynomial ring in infinitely many variables). Do you see a non-trivial ideal $J\subset R$ such that $R/J\cong R$? (There are a lot).

What I was aiming at was that, for any infinite set $S\subseteq\mathbb{N}$, choosing $J=(\{x_i\mid i\notin S\})$ gives a ring isomorphism $R/J\cong R$. The problem with my answer was that this is not the same as an isomorphism of $R$-modules. The definition of $R$-module is an abelian group that is acted on by $R$ (by scalar multiplication); the fact that $R/J\cong R$ as rings includes the fact that they are isomorphic as abelian groups (under addition), which is part of what is necessary for an isomorphism of $R$-modules, but as all the other (correct) answers point out, the essential problem lies in the scalar multiplication aspect: $J$ annihilates $R/J$ (i.e., scaling $R/J$ by any element of $J$ gives the zero map), while $R^n$ has trivial annihilator, so $J$ must be trivial.
A: Correct me if I'm wrong, but isn't it obvious that if $J \neq 0$, $R/J$ can't be a free $R$-mod because anything in $J$ acts by $0$ on $R/J$? Therefore an equation like $jr = 0$ holds for $j \neq 0$, which can't happen if $R/J$ was free.
A: Yes.  A nice way to see this is via the annihilator $\operatorname{ann}(M)$ of a module $M$: it is the set of all $x \in R$ such that $xm = 0$ for all $m \in M$.  One shows immediately that $\operatorname{ann}(M)$ is an ideal of $R$ and that isomorphic modules have equal annihilators.  
If you take annihilators of both sides of your isomorphism $R/J \cong R^n$, you'll get the desired conclusion.  I could say more, but I'll leave it up to you for now because this is a very important and enlightening exercise.
