• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Echoserver.jar by Marty Hall beginner problem

 
Ranch Hand
Posts: 339
7
Tomcat Server Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use Hall's echo server class by typing into terminal in the directory where the echoserver.jar sits.

sudo java -jar echoserver.jar

Error message: Invalid or corrupt jarfile echoserver.jar

I downloaded the echoserver.jar from
Chapter 19 downloads

Do I need to remake the .class files as package in netbeans and run them there instead of using the .jar?

I am using Ubuntu Linux 7.10, AMD 64, Netbeans 6.1, java version 1.7.0

Another beginner question: If I am running the echoserver.jar do I need to turn off tomcat?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you examine the contents of the JAR file you will see that it is not an executable JAR and cannot be run with the "java -jar" command:


Another beginner question: If I am running the echoserver.jar do I need to turn off tomcat?


If they are both configured to use the same port, yes (or change the EchoServer.java file to use a different port).
 
margaret gillon
Ranch Hand
Posts: 339
7
Tomcat Server Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If you examine the contents of the JAR file you will see that it is not an executable JAR and cannot be run with the "java -jar" command:



I see....if the jar has packages with .class files then it is executable.

I unpacked it, compiled, and am able to run the echoserver.class using an open port 8680. Thanks.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by margaret gillon:
I see....if the jar has packages with .class files then it is executable.



Actually it is the manifest file which makes a JAR file executable. Have a look at the Java Tutorial on JAR Files for more.
 
margaret gillon
Ranch Hand
Posts: 339
7
Tomcat Server Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it... Thanks for the explanation about the manifest file and for the link.
 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic