Reputation: 686
I have a java class (ts3.java) and i`m using teamspeak3.jar for a project . In ts3.java i'm importing :
import com.github.theholywaffle.teamspeak3.TS3Api;
import com.github.theholywaffle.teamspeak3.TS3Config;
import com.github.theholywaffle.teamspeak3.TS3Query;
import com.github.theholywaffle.teamspeak3.api.TextMessageTargetMode;
import com.github.theholywaffle.teamspeak3.api.event.TS3EventAdapter;
import com.github.theholywaffle.teamspeak3.api.event.TS3EventType;
import com.github.theholywaffle.teamspeak3.api.event.TextMessageEvent;
import java.util.logging.Level;
and compile using javac -cp teamspeak3.jar ts3.java
and works perfectly
When i try to run java -cp .:./teamspeak3.jar ts3
it sais : Error: Could not find or load main class ts3
I'm trying to make it run for 30 minutes now and no success. Tried everything. Please help me. I don't want to put ts3.class in some .com folder and adding package to it.
Upvotes: 1
Views: 54
Reputation: 124714
If I understand correctly, your main class is called ts3
,
and it is the default package (no package).
Then, verify that ts3.class
exists in the current directory (ls ts3.class
).
Because it looks like that's not the case.
If ts3.class
is in a different directory, or not in the default package (has a package ...
declaration in it),
then you'll need to adjust the value of the -cp
parameter and possibly your working directory.
Other things to be careful with:
The class must be declared public, and have a method with signature public static void main(String[] args)
Class names are case sensitive. If the name is Ts3
, then it should be in a file Ts3.class
, and the command should use Ts3
as the class name to run.
In Windows, the separator in the classpath is ;
(semicolon), not :
(colon). So then the value of -cp
should be something like .;teamspeak3.jar
Upvotes: 1