wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes Echoserver.jar by Marty Hall beginner problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Echoserver.jar by Marty Hall beginner problem" Watch "Echoserver.jar by Marty Hall beginner problem" New topic
Author

Echoserver.jar by Marty Hall beginner problem

margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 317
    
    5

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?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8843
    
    7

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).


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
margaret gillon
Ranch Hand

Joined: Nov 12, 2008
Posts: 317
    
    5

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

Joined: Oct 29, 2001
Posts: 8843
    
    7

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

Joined: Nov 12, 2008
Posts: 317
    
    5

Got it... Thanks for the explanation about the manifest file and for the link.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Echoserver.jar by Marty Hall beginner problem
 
Similar Threads
Java Mail
NoClassDefFoundError - where to put Javamail JAR file?
Accessig the properties file from outside the jar file
JDBC Help!!!
How can i run this Applet offline?