How can I convert a .class file of java to .exe file

how about ... not?
why would you want to do that? one of the major upsides of Java is that it's platform independent, if you create an exe, you'll limit it to the Windows platform.

just create a .jar file, that is just as well an executable, which keeps the platform independency intact.

http://docs.oracle.com/javase/tutorial/deployment/jar/

if you still would want to create a .exe, there are enough tools that can transform your .jar files into .exe files, just google for it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.