Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By Norm

Thread: Running a UDPServer on cmd window

  1. #1
    hylee101001 is offline Member
    Join Date
    Apr 2012
    Posts
    5
    Rep Power
    0

    Default Running a UDPServer on cmd window

    I have tried to make a UDPServer and complied it. Howver, it doesn't run while another file, DisplayIP.class works.
    It casts the error like the picture below. So i thought, it might be a problem with my pahtes, yet, it still doesn't work.
    How can i fix this?

    JAVA_HOME:
    C:\Program Files\Java\jdk1.7.0_03
    CLASSPATH:
    .;%JAVA_HOME%\lib\tools.jar
    path:
    ;%JAVA_HOME%\bin



    Running a UDPServer on cmd window-capture.jpg

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,607
    Rep Power
    23

    Default Re: Running a UDPServer on cmd window

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.


    Is the class in a package? Remove the package statement for easier testing. Otherwise position the class file to reflect the package and include the package name with the class name with the java command.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,607
    Rep Power
    23

    Default Re: Running a UDPServer on cmd window

    command? ex)java UDP.UDPServer
    You need to be in the folder that contains the UDP folder. The java command will follow the package path to find the class file.
    hylee101001 likes this.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    hylee101001 is offline Member
    Join Date
    Apr 2012
    Posts
    5
    Rep Power
    0

    Default Re: Running a UDPServer on cmd window

    Quote Originally Posted by Norm View Post
    You need to be in the folder that contains the UDP folder. The java command will follow the package path to find the class file.
    Um.. I opened the command window in UDP folder which is package. and I typed like following:
    ---------------------------------------------------
    C:\Users\Hongyun\workspace\MyDemo5\src\UDP>java UDP.UDPServer 1234
    Error: Could not find or load main class UDP.UDPServer

    C:\Users\Hongyun\workspace\MyDemo5\src\UDP>
    -------------------------------------------------------
    FYI, 1234 stands for the port number setting.
    Of course my source starts with "package UDP;"

  5. #5
    hylee101001 is offline Member
    Join Date
    Apr 2012
    Posts
    5
    Rep Power
    0

    Default Re: Running a UDPServer on cmd window

    Oh.. I was stupid. I should have opened it outside of the package folder.
    Thank you!! It was very helpful.!!

Similar Threads

  1. Closing secondary window from button in primary window
    By KoncentriK in forum New To Java
    Replies: 4
    Last Post: 02-26-2012, 01:24 AM
  2. Replies: 7
    Last Post: 12-18-2011, 04:13 AM
  3. Replies: 1
    Last Post: 07-25-2011, 10:24 AM
  4. Replies: 4
    Last Post: 01-10-2010, 07:48 AM
  5. change url in parent window from child window
    By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-09-2009, 12:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •