Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthoradmin
    • CommentTimeApr 1st 2008
     
    This forum is for discussion of Project 7
    • CommentAuthortdgray
    • CommentTimeApr 8th 2008
     
    The example from the book that relates to this program is on page 723. It is also available on the CD (available in General Collaboration forum) under /examples/network/DatagramAdditionClient.java .
    • CommentAuthorzdhayes
    • CommentTimeApr 9th 2008
     
    I am getting a clean compile, but when I run it I get this:

    Exception in thread "main" java.lang.NumberFormatException: For input string: "TemperatureServer.java"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:447)
    at java.lang.Integer.parseInt(Integer.java:497)
    at DatagramTemperatureClient.main(DatagramTemperatureClient.java:76)

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.

    Does anything jump out at you? If you need to see more code, let me know and I will show you what you need. For now, I am only trying to return the temperature in Seville. When I get it working with that, I will add the loop and request multiple temperatures.

    I also have not included the returned temperature in the println command because I am unsure of how to declare that variable or what to name it or where to get it from. So if you know those answers, please let me know.

    Thanks,

    Zack
    • CommentAuthormdcarr
    • CommentTimeApr 9th 2008
     
    I'm just starting the code, but my best guess is that the server either isn't running or the port isn't setup right... I started up the server, changed the port, and used the code in the book to start up, changed the string name to one of the towns and it ran.. Only about 10 min into this, so haven't looked at a lot of the code yet..
  1.  
    i did the same thing as michael. Started using the book code, changed the string name to one of the towns, but mine won't work. It compiles fine, but when i hit run nothing shows up. It doesn't reach the end of the program, it just sits there. I've put print statments in it and have figured out it doesn't get past the client.receive( inDgp ); line that is in there. Can anyone think of any reason why this would be happening? I have the host and the port right.

    Thanks for any help,

    Ryan
    • CommentAuthoradmin
    • CommentTimeApr 12th 2008
     
    Are you running both the server and the client? If the server isn't running, there is nothing to respond to the client. That would cause the symptoms you are mentioning (runs with no response) when testing.
  2.  
    How do I compile things using the javac? So far I've only used JGrasp for all of my programs, however, it will not allow me to run both the server and client applications at the same time. Any help in solving this problem would be appreciated.
    • CommentAuthorcdstreit
    • CommentTimeApr 13th 2008 edited
     
    Im not 100% sure on how to compile using javac, but i think its just "javac TemperatureServer" in the dir the src code is, but you can use JGrasp to compile the server code, and then run the program outside JGrasp with the command "java TemperatureServer" in the dir with the compiled class file. Now this is assuming that the the dir with java and javac are set in your path so that they can be accessed with out having to be in the directory... If you open a cmd box (start - run - cmd) and type java enter it should give you a listing of the options of the java runtime. If it doesn't it is not in your path and you can set up your path(which I don't remembier how to do of the top of my head) or you will have to goto the director java is in (something like c:\program files\jdk1.#.#.#### \bin\ where the # is the version of the jdk you have installed) and type java drive:\fullpath\TemperatureServer to get it to work.

    Chris
    • CommentAuthorkdtaylor
    • CommentTimeApr 13th 2008
     
    i am having the same problem michael. when i try running the server from the command prompt it says there is an exception a NoClassDefFound error. i am not sure what this menas as i copied the server code exactly and compiled it in jgrasp before trying to run it in the command prompt any help with this error is appreciated.
    kevin
    • CommentAuthorkdtaylor
    • CommentTimeApr 13th 2008
     
    also when i compiled the server code in jgrasp i get this message
    Note: C:\Documents and Settings\Kevin\Desktop\TemperatureServer.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    i was trying to find a checkbox to see the details but couldnt find this option. does anyone know where this is? i tried using jgrasp help but that was a joke.
    Kevin
    • CommentAuthorjmscott2
    • CommentTimeApr 13th 2008
     
    I got the same message when I ran the server, but I was still able to test my program with it.

    Also, it gave an example somewhere in the chapter about how to run both the server and client from the command line. You open both command windows and then you can type in SET CLASSPATH=C:\MIS4330\Projects;%CLASSPATH% (where C:\MIS4330\Projects is the directory with the compiled class files) for each one.
    Then all you have to do is type: java Project7 or java TemperatureServer, or whatever you called it, to run them.
    (Note: You have to compile first before running it this way!) Hope that helps.
    • CommentAuthoradmin
    • CommentTimeApr 13th 2008
     
    You can safely ignore the "Recompile with -Xlint" messages and everything will still run. Jen's example (above) is correct about how to run both programs. If you are using JGrasp, you can compile your programs in it (no need to use javac) and just run the class for the server (or both classes) from the command prompt.