Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How to run *.class with double click

  Asked By: Sienna    Date: Dec 13    Category: Java    Views: 1422
  

After compiling a .java file I receive a .class file . To execute this file I
must use DOS command (e.g : C:\jdk\bin\java JavaApplication).

I have choose Open With Java.exe for all .class file . But it doesn't work.

I want to execute .class file without using MSDOS (e.g double click to run) but
I don't know how .

Share: 

 

8 Answers Found

 
Answer #1    Answered By: Kawthar Malik     Answered On: Dec 13

I am not sure how to do it but i think that is not
what you want. Because you are not executing lets say
Main.class you are executing Main (as a class  that
contians main function). So the name of the file  could
be Holiday.class but if class that contains main() is
named Christmas then you execute  it by java  Christmas
and not Holiday.class.

Thats why i do not know how to do it, because you have
to somehow omit the .class part and call main
Function.

 
Answer #2    Answered By: Anthony Smith     Answered On: Dec 13

>I want to execute  .class file  without using MSDOS (e.g double
>click to run) but I don't know how .

IMHO I don't think that's feasible, If you wan't something like double  click
just put in bat file,and the content of bat file is java  main.class
But again it's just work  around.

 
Answer #3    Answered By: Edna West     Answered On: Dec 13

It is not feasible to execute  a class  file by double  clicking it but you can
convert it to an (platform dependent) executable (for windows apparently). There
are several free tools that can help you with this task. It's been a while since
I last did this and thus I cannot remember the tool name that I used.

 
Answer #4    Answered By: Guilherme Silva     Answered On: Dec 13

u can either create a jar file  or a batch script to run  ur class  files by
doubleclicking.

 
Answer #5    Answered By: James Evans     Answered On: Dec 13

make a .bat file  is a good idea.

 
Answer #6    Answered By: Clarence Nichols     Answered On: Dec 13

You can install your java  program as a service.

You can use the javaservice provided at
www.multiplan.co.uk/.../downloads.html

But again this will be platform specific and only works on windows.
Do let us know if this answers your question.

 
Answer #7    Answered By: Geena Ma.     Answered On: Dec 13

from what i had learned so far you can't double
click and run  in it windows. If you want to run it by
double click  the only way I know is that make ur class
file to an executable jar file  that way you can double
click the jar file and run it.

 
Answer #8    Answered By: Garrett Brooks     Answered On: Dec 13

Just Make a bat File.

& call *.class with the help of .bat file

 
Didn't find what you were looking for? Find more on How to run *.class with double click Or get search suggestion and latest updates.




Tagged: