Two Laptop Bag*
The moose likes Java in General and the fly likes open Cmd program by double click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "open Cmd program by double click" Watch "open Cmd program by double click" New topic
Author

open Cmd program by double click

Marco Galea
Ranch Hand

Joined: Mar 30, 2011
Posts: 30
Hi to all,

I exported my project into a .jar using eclipse. The problem or question I have is, if it is possible to make my program (which runs on the cmd) by just double clicking on the jar file. Cause at the moment i have to run it by opening the cmd myself, go the directory of the jar and input "java -jar myproj.jar"

Thanks in advance
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

You can create a batch file (under Windows) or a shell script (*nix) that you can use to run your console application. E.g., for Windows:

Save it under a name with .bat extension, and you'll have the desired result - double click on this file will run your application.


The quieter you are, the more you are able to hear.
Marco Galea
Ranch Hand

Joined: Mar 30, 2011
Posts: 30
Kemal Sokolovic wrote:You can create a batch file (under Windows) or a shell script (*nix) that you can use to run your console application. E.g., for Windows:

Save it under a name with .bat extension, and you'll have the desired result - double click on this file will run your application.


Worked Great Thank you very much
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

You are welcome!
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2176
    
  47
Under Windows you can also associate files of type .jar with java.exe and then you can double click the jar to get it to run.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: open Cmd program by double click
 
Similar Threads
how to create exe file
Setting ojdbc14.jar as classpath.
How to capture return value of a method in Batch file
problem in starting the app in double click
Adding external JARs