Results 1 to 16 of 16
  1. #1
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default How to run .jar files without prompt, How?

    Hello. Im am looking how to run .jar files without the cmd. When I double-click the file nothing happens. I got JRE + JDK installed. I am not new to Java, because i allready wrote a game, and it works
    Im hoping somebody can help me with this.
    Kind Regards, Guus Ketelings

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    8

    Default Re: How to run .jar files without prompt, How?

    See the example here: How to make an executable JAR file

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,561
    Rep Power
    25

    Default Re: How to run .jar files without prompt, How?

    The OS controls that happens when you open/double click on a file.
    What OS are you using? What verions of java have you installed?
    Some java installations will set the OS so it will open a jar file.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    Quote Originally Posted by Norm View Post
    The OS controls that happens when you open/double click on a file.
    What OS are you using? What verions of java have you installed?
    Some java installations will set the OS so it will open a jar file.
    Im using Windows 7, with the newest version of JDE and JDK.
    But i mean, that i can run it as an .exe
    Well, If i can atleast open the .jar file would be useful :)
    Kind Regards, Guus Ketelings

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,561
    Rep Power
    25

    Default Re: How to run .jar files without prompt, How?

    What happens when you try to "open" the jar file by double clicking on it?
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    alexandra12 is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    When exporting the jar file you can make it runnable and get it to run on a certain class file . You can then create a bat file and run the application by clicking on the bat file.

    Example
    @ECHO OFF
    java -jar test.jar

    Just make sure that the path to the jar file is in your classpath.

  7. #7
    alexandra12 is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    you could right click on the jar file and choose open with and choose winzip or something like that

  8. #8
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    Quote Originally Posted by Norm View Post
    What happens when you try to "open" the jar file by double clicking on it?
    Nothing :S

  9. #9
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    Quote Originally Posted by alexandra12 View Post
    When exporting the jar file you can make it runnable and get it to run on a certain class file . You can then create a bat file and run the application by clicking on the bat file.

    Example
    @ECHO OFF
    java -jar test.jar

    Just make sure that the path to the jar file is in your classpath.
    So how can i convert multiple or one classe(s) in a .bat file?

  10. #10
    alexandra12 is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    I use eclipse as a dev tool to write my code.
    In eclipse when you choose export jar file it gives you an option to choose which class file you want to initialize on. That's the only way I know ..not sure what application you are using if any to write your code.

  11. #11
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    Quote Originally Posted by alexandra12 View Post
    I use eclipse as a dev tool to write my code.
    In eclipse when you choose export jar file it gives you an option to choose which class file you want to initialize on. That's the only way I know ..not sure what application you are using if any to write your code.
    I use Eclipse too, Can you go in detail for me, what optiosn i have to select? I know where to Export it and how to make it a .jar file, but not what you told me :)
    Kind Regards, Guus Ketelings

  12. #12
    alexandra12 is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    export
    export
    runnable jar file
    In the launch configuration field - choose the associated class file that you want to be runnable
    in the export destination - choose the destination
    finish
    OK
    How to run .jar files without prompt, How?-runnable-jar-option.png

  13. #13
    alexandra12 is offline Member
    Join Date
    Jul 2011
    Posts
    34
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    How to run .jar files without prompt, How?-runnable.png

  14. #14
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    Quote Originally Posted by alexandra12 View Post
    export
    export
    runnable jar file
    In the launch configuration field - choose the associated class file that you want to be runnable
    in the export destination - choose the destination
    finish
    OK
    Click image for larger version. 

Name:	runnable jar option.png 
Views:	20 
Size:	22.2 KB 
ID:	4056
    Thank you so much! :D

  15. #15
    0504Guusjuhh is offline Member
    Join Date
    Aug 2012
    Location
    Neer
    Posts
    7
    Rep Power
    0

    Default Re: How to run .jar files without prompt, How?

    Quote Originally Posted by 0504Guusjuhh View Post
    Thank you so much! :D
    Nothing happens again? D:

  16. #16
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,561
    Rep Power
    25

    Default Re: How to run .jar files without prompt, How?

    Open a command prompt, change to the folder with the jar file and enter the java command with the -jar option:
    java -jar <JARFILENAMEHERE>

    Copy the contents of the console window here.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Cmd Prompt
    By AndrewM16921 in forum New To Java
    Replies: 1
    Last Post: 06-03-2012, 09:50 AM
  2. CMD Prompt Equivelants to a GUI
    By Rahim2312 in forum New To Java
    Replies: 8
    Last Post: 05-11-2012, 04:06 AM
  3. Replies: 4
    Last Post: 03-25-2010, 04:47 PM
  4. help me!!!! about command prompt..
    By kureikougaiji in forum New To Java
    Replies: 2
    Last Post: 11-13-2008, 06:15 PM
  5. input prompt
    By angelbaby21 in forum New To Java
    Replies: 8
    Last Post: 08-25-2008, 04:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •