Click here to Skip to main content
15,902,635 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a program in java and then compile it gives after compiling it gives corresponding .class file but my question is I want to run it without using cmd prompt. I want to run it by using .bat file for run .class file.

Please help me.
Posted
Updated 23-Dec-10 2:10am
v2
Comments
Richard MacCutchan 23-Dec-10 9:06am    
You have two versions of the same suggestion below. You say one works and one does not; is the problem resolved for you?

In case of run java class file by using batch file you need to create .bat file for it.
For create .bat file open Notepad and then Type
Java classname
pause

And then save it as filename.bat and
now when you click on filename.bat file it run and gives output in console window.
 
Share this answer
 
v2
Comments
ShilpaKumari 23-Dec-10 8:25am    
Thanks for your help. It works
Create a .BAT file that contains the correct java call, something like:
@echo off
java -c [your classpath] ClassToRun
 
Share this answer
 
Comments
ShilpaKumari 23-Dec-10 8:29am    
It gives me error: couldn't create javd virtual machine. A fatal exception has occured. Please help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900