• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How to execute JAR file

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a jar file which is downloaded from net now i'm trying to execute it as follows

java -jar SimpleWebServer.jar

I'm getting the following message while executing

java.net.BindException: Address already in use: JVM_Bind

Can any one please tell me the reason and how to execute successfully?

Thanks
 
Marshal
Posts: 65416
248
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you looked up that Exception in the API?
 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For executable jar you need to specify the startup class who have main method in that class in manifest file .
Example :
Main-Class: classname make this entry in manifest file .

then make jar file using jar -cmf filename. Jar mainfestfilename.txt files you want to add

once it’s done just double click on the jar file it will execute automatically like .exe



 
Sheriff
Posts: 21784
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not the problem, Sap. The class is executed just fine. An exception is thrown however, and that needs to be resolved.
 
swapnl patil
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This message implies that one of the ports the app server is attempting to bind to is already in use by some other process. Check the server.log file to see which port is in conflict. Then resolve the conflict by stopping the process that is already using the port or change the server configuration to use a different port.
 
Bartender
Posts: 2347
102
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unrelated to main post,

settings to file type to be made in windows for the extension "jar" :

Goto File types.....

jar file > Advanced

Confirm open after download [ensure this is checked]
Create an action called Open


Action:
open

Application used to perform action:
"XXXX\bin\javaw.exe" -jar "%1" %*

Use DDE [ensure this is checked]

Application:
javaw

Topic:
System




Sometimes due to registry problems, etc, some of my clients had this issue in a windows
This is wht i used to do, so i thought i would share this with you.

--------------------------------------
Back to the post .....

Btw the error shown to the OP indicates that the jar file is indeed being executed !!!

I would suspect a RMI application would throw the BindException (when trying to bind a server to same port again)

If this is the case, then before running the jar file, check for javaw.exe in your active process and kill them
also check port usage to see if given port is available.

 
Oh the stink of it! Smell my tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!