I\'ve the java class:
package com.server.main;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class Main {
pu
Look here: http://docs.oracle.com/javase/tutorial/getStarted/problems/index.html
I find there answer to my problem with compile and run java application in terminal.
You need to refer from one level above the package directory that you are using. So your package here is com.server.main which means your directory structure is:
src/
com/
server/
main/
Main.java
Main.class
You don't necessarily need to be at src directory (that's the reason we use -cp or -classpath option) and give the following command
Use:
java -cp C:\Users\workspace\Tests\src com.server.main.Main
Your Main
is in a package, I believe you need
java -cp C:\Users\workspace\Tests\src com.server.main.Main
You might also move to the top folder of your project and use .
like
cd C:\Users\workspace\Tests\src
java -cp . com.server.main.Main
Finally, you could add that folder to your CLASSPATH like
set CLASSPATH=C:\Users\workspace\Tests\src
java com.server.main.Main