Reputation: 107
I think I trying to solve this problem for any ways such as: CLASSPATH is wrong, Remove cache file , Restart.. etc...
BUT One interesting issues: I got fixed when I trying to add Libraries' New Java(such as spigot-1.17.1.jar) and Edit Modules Dependencies(Scope section) Normal Provided(Maven: org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT) -> Compile
Then this got fixed BUT I DON'T KNOW WHY THIS WORKING TO ME
EXPLAIN:
First of all, When I click(application menu) and press RUN button then I got this msg:
Error: Could not find or load main class me.kennytool.betaplugin.BetaPluginHandler.
Caused by: java.lang.NoClassDefFoundError: org/bukkit/event/Listener
package me.kennytool.betaplugin;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class BetaPluginHandler implements Listener {
public static void main(String[] args) {
}
@EventHandler
public void onJoin(PlayerJoinEvent e){
Player player = e.getPlayer();
if (player.hasPlayedBefore()){
e.setJoinMessage(ChatColor.AQUA + "[REJOIN]" + ": " + ChatColor.BOLD + player.getDisplayName() + ChatColor.YELLOW + " WELCOME BACK");
// Have experienced logging log
}else{
e.setJoinMessage(ChatColor.YELLOW + "[FIRST]" + ": " + ChatColor.BOLD + player.getDisplayName() + ChatColor.BLUE + " WELCOME FIRST!");
// First logging on!
}
}
}
I don't know why this error shows to me.... Too many solution got it to solve this problems but this not WORK to me
NOTE: I used Java and with Minecraft Development Kit(Spigot)
(This probs doesn't occur in plain Java Project)
Upvotes: 0
Views: 381
Reputation: 5893
From your screenshots, all the dependencies are marked as scope
provided, this means that they are expected to be provided externally and not available on the classpath. Please provide the contents of your pom.xml to verify, but I suspect you'll find a line on your dependencies that reads something like <scope>provided</scope>
deleting this should resolve the issue. You can read more about maven dependency scopes here: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#dependency-scope
Upvotes: 1