1 Attachment(s)
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
Attachment 3510
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.
Re: Running a UDPServer on cmd window
Quote:
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.
Re: Running a UDPServer on cmd window
Quote:
Originally Posted by
Norm
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;"
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.!!