First of all "
compile the .java file using c#.net" is an oxymoron.
However, you might really need an answer to different question: using Java language in .NET, then —
Why not?
First of all, it depends what do you call Java. I think you mean just Java programming language, so I don't see why not. I used to try out J#.
Let's try to find such things:
J# (http://en.wikipedia.org/wiki/J_Sharp) is Microsoft implementation, I used to try it with VS 2005; I don't remember is it supplied with later VS products but I think it can be installed -- please check up.
Ja.NET (http://www.janetdev.org) -- an open source implementation of a Java 5 JDK (Java development tools and runtime) for .NET
IKVM.NET (http://www.ikvm.net) -- 1) a Java Virtual Machine implemented in .NET; 2) a .NET implementation of the Java class libraries; 3) tools that enable Java and .NET interoperability.
Not too bad for first attempt to find results just from
Wikipedia.
You may want to try out and consider sharing your experience.
Good luck! ;)