0

Need to export clickable and executable file in eclipse. Simple exporting does not launch the program. How to get a clickable jar?

5
  • what exactly did u try search in google ?? Commented Apr 29, 2015 at 14:02
  • there are two types of jar 1) normal jar of libraries jar 2) another is executable jar Commented Apr 29, 2015 at 14:03
  • You should probably read this: docs.oracle.com/javase/tutorial/deployment/jar/basicsindex.html Commented Apr 29, 2015 at 14:05
  • Srinath, "How to create runnable file from eclipse." Could you create and show me your result ? Commented Apr 29, 2015 at 14:06
  • Try this: help.eclipse.org/luna/… Commented Apr 29, 2015 at 14:09

3 Answers 3

2

You should click file, then click export, then click java and save it as runnable jar file.

To run the .jar file, open cmd or terminal, make sure you are in the right path and

type java -jar <jar-file-name>.jar

Note if you cant run it, mostly its your file path not correct

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

I have mentioned that i did, but could not run it
i got your answer, but is there any way to run it without cmd ?
@FarhadMammadli Double click on it
You have to add an entry name Main-Class in MANIFEST file, or run as java -cp <jarfile> <package.mainClass>: docs.oracle.com/javase/tutorial/deployment/jar/appman.html
0

Try to go in brief using the below link : http://www.wikihow.com/Create-an-Executable-File-from-Eclipse

7 Comments

Just visited this site. Still no results:/
If it is just opening in WINRAR .try to run using javaw <JAR FILE NAME>
try to run using java -jar <jar file name> and tell is it throwing any exception???
it runs, but how to do it without cmd ?
@FarhadMammadli What do you mean, run it without cmd? Its a command line application that expects input from the command prompt itself. The question would make sense if it were for example a Swing or JavaFX application which actually opens up a graphical window.
|
0

The code listing represents a command prompt application; you can only make it do anything when physically run on the command prompt / shell itself, especially because it expects user input that way. The reason why turning the given program into an executable jar will result in "nothing" happening when you double click it, is because under Windows the default binding for the 'jar' filetype will be setup to run through javaw.exe - and javaw.exe is designed to not open up any command prompt.

In order to make a program be able to run without the command prompt so you only have to double click on it, you will need to get rid of the command prompt interface and instead build a proper graphical user interface, using for example JavaFX or Swing.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.