Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Echoserver.jar by Marty Hall beginner problem

 
Ranch Hand
Posts: 338
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: 338
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: 338
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic