When using javac -cp lib/<discord-rpc>.jar:. <main>.jar (obviously with the real names), the compilation has no issues and finishes just fine. However, when I try to run the app using java -cp <same classpath> <main>.class, it gives me:
Exception in thread "main" java.lang.NoClassDefFoundError: club/minnced/discord/rpc/DiscordRPC
at mainGame.Game.<init>(Game.java:135)
at mainGame.Game.main(Game.java:408)
Caused by: java.lang.ClassNotFoundException: club.minnced.discord.rpc.DiscordRPC
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
Not sure why this is, since the compiler had no issue with it. If I switch the line with the one after it (instantiating my DiscordEventHandlers), it's the same error but with the DiscordEventHandlers class, so it's not limited only to DiscordRPC. Any clue what's wrong? 100% could be a user error, I don't do too much with external libs, so I might be doing something wrong.
When using
javac -cp lib/<discord-rpc>.jar:. <main>.jar
(obviously with the real names), the compilation has no issues and finishes just fine. However, when I try to run the app usingjava -cp <same classpath> <main>.class
, it gives me:Not sure why this is, since the compiler had no issue with it. If I switch the line with the one after it (instantiating my
DiscordEventHandlers
), it's the same error but with theDiscordEventHandlers
class, so it's not limited only toDiscordRPC
. Any clue what's wrong? 100% could be a user error, I don't do too much with external libs, so I might be doing something wrong.