#what is this error and how do I fix it?
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
somebody help
hiya !
what are you building ?
can you show your java file pls ?
the one called HelloController.java
here
import com.github.philippheuer.credentialmanager.domain.OAuth2Credential;
import com.github.philippheuer.events4j.api.domain.IDisposable;
import com.github.twitch4j.TwitchClient;
import com.github.twitch4j.TwitchClientBuilder;
import com.github.twitch4j.chat.TwitchChat;
import com.github.twitch4j.chat.events.channel.ChannelMessageEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import java.net.URL;
import java.nio.channels.Channel;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
public class HelloController implements Initializable {
@FXML
private TextField sendText;
@FXML
private Button sendTextButton;
@FXML
private TextArea receiveMessage;
OAuth2Credential credential = new OAuth2Credential("twitch", "");
TwitchClient twitchClient;
{
twitchClient = TwitchClientBuilder.builder()
.withChatAccount(credential)
.withEnableChat(true)
.build();
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
twitchClient.getChat().joinChannel("monkeyoohlala");
twitchClient.getChat().sendMessage("monkeyoohlala", "Hey!");
twitchClient.getEventManager().onEvent(ChannelMessageEvent.class, e -> {
receiveMessage.appendText(e.getMessage() + "\n");
System.out.println("[" + e.getChannel().getName() + "] " + e.getUser().getName() + ": " + e.getMessage());
});
}
@FXML
void sendText(ActionEvent event) {
String messageToSend = sendText.getText();
twitchClient.getChat().sendMessage("monkeyoohlala", messageToSend);
receiveMessage.appendText(messageToSend + " test" + "\n");
}
}```
Detected code, here are some useful tools:
package org.example.scrambler;
import com.github.philippheuer.credentialmanager.domain.OAuth2Credential;
import com.github.philippheuer.events4j.api.domain.IDisposable;
import com.github.twitch4j.TwitchClient;
import com.github.twitch4j.TwitchClientBuilder;
import com.github.twitch4j.chat.TwitchChat;
import com.github.twitch4j.chat.events.channel.ChannelMessageEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import java.net.URL;
import java.nio.channels.Channel;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
public class HelloController implements Initializable {
@FXML
private TextField sendText;
@FXML
private Button sendTextButton;
@FXML
private TextArea receiveMessage;
OAuth2Credential credential = new OAuth2Credential("twitch", "");
TwitchClient twitchClient;
{
twitchClient = TwitchClientBuilder.builder().withChatAccount(credential).withEnableChat(true).build();
}
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
twitchClient.getChat().joinChannel("monkeyoohlala");
twitchClient.getChat().sendMessage("monkeyoohlala", "Hey!");
twitchClient.getEventManager().onEvent(ChannelMessageEvent.class , e -> {
receiveMessage.appendText(e.getMessage() + "\n");
System.out.println("[" + e.getChannel().getName() + "] " + e.getUser().getName() + ": " + e.getMessage());
}
);
}
@FXML
void sendText(ActionEvent event) {
String messageToSend = sendText.getText();
twitchClient.getChat().sendMessage("monkeyoohlala", messageToSend);
receiveMessage.appendText(messageToSend + " test" + "\n");
}
}
Closed the thread due to inactivity.
If your question was not resolved yet, feel free to just post a message to reopen it, or create a new thread. But try to improve the quality of your question to make it easier to help you 👍
can someone help me?
hey there
do you have a module-info.java file ?
show its code pls
requires javafx.controls;
requires javafx.fxml;
requires twitch4j;
requires credentialmanager;
requires twitch4j.chat;
requires events4j.api;
requires events4j.core;
opens org.example.scrambler to javafx.fxml;
exports org.example.scrambler;
}```
Detected code, here are some useful tools:
module org.example.scrambler {
requires javafx.controls;
requires javafx.fxml;
requires twitch4j;
requires credentialmanager;
requires twitch4j.chat;
requires events4j.api;
requires events4j.core;
opens org.example.scrambler to javafx.fxml;
exports org.example.scrambler;
}
I tried that before
do it now
I uploaded your attachments as Gist.
thats the error I get after I put that in
System.out.println("[" + e.getChannel().getName() + "] " + e.getUser().getName() + ": " + e.getMessage());
these are other issues
right here is the problem
something is wrong with .getName()
.getMessage() works fine
try to put static string literals there instead
dnt use getName()
for now
one second
let me redo this
static string literals?
receiveMessage.appendText(e.getMessage() + "\n");
//System.out.println("[" + e.getChannel().getName() + "] " + e.getUser().getName() + ": " + e.getMessage());
});```
Detected code, here are some useful tools:
twitchClient.getEventManager().onEvent(ChannelMessageEvent.class , e -> {
receiveMessage.appendText(e.getMessage() + "\n");
//System.out.println("[" + e.getChannel().getName() + "] " + e.getUser().getName() + ": " + e.getMessage());
}
);
if I comment out the getName method it works fine
its for twitch a game streaming service
it gets the messages but I cant seem to get the channel and username
I uploaded your attachments as Gist.
this is the error
something is wrong with that method then
you need to figure it out
you can debug it
i dnt know what those libraries or classes are sorry
🤷♂️
I put a break point there and this is what comes out
I dont know how to fix it 😦
ok this is the steps I took, I added the dependencies and then edited module-info.java
sounds like ProxyConfig class is not there
maybe you're not using the right version of the library
I dont know how dependencies work
check your pom.xml
<groupId>com.github.twitch4j</groupId>
<artifactId>twitch4j</artifactId>
<version>1.17.0</version>
</dependency>```
Detected code, here are some useful tools:
<groupId> com.github.twitch4j < / groupId > <artifactId> twitch4j < / artifactId > <version> 1.17.0 < / version > < / dependency >
alright, so this dependency is new to your project now ?
no I added it when I first started it
did u update the project with mvn update ?
yes
alright, did u try clean install ?
clean install?
I dont know what that is
do I do that in command prompt?
in terminal
oh I see it
Error: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
I get this error
which command did u use here ?
./mvnw clean install
and you have java installed right ?
you have to install java dude !
that must be embedded with ide
it is I believe
or 17 as u like
is there a big difference?
~~reopen ~~ restart your IDE
okay
in terminal run the following
java --version
PS G:\Scrambler\Scrambler> java --version
java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)
PS G:\Scrambler\Scrambler>
ok now run the ./mvnw clean install
PS G:\Scrambler\Scrambler> ./mvnw clean install
Error: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
PS G:\Scrambler\Scrambler>
do I have to add the JDK to my project?
you have to set it manually in your operating system
okay
i thought that it's done automatically :/
If you use the installer, yes
I used the bin not the msi
if you're on Windows
you enter in /C: > program files > java
you'll find the jdk directory
copy the path
well tahts the example
ok I see the google

PS G:\Scrambler\Scrambler> ./mvnw clean install
The system cannot find the file G:\Scrambler\Scrambler.mvn\wrapper\maven-wrapper.properties.
Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."
At line:1 char:282
- ... pe]::Tls12; $webclient.DownloadFile('https://repo.maven.apache.org/ma ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [], MethodInvocationException
- FullyQualifiedErrorId : WebException
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Caused by: java.lang.ClassNotFoundException: org.apache.maven.wrapper.MavenWrapperMain
PS G:\Scrambler\Scrambler>
you are missing a folder :/
how did you create this project ?
I got this warning when I restart IDE
^
Using new project and javafx
did you delete .mvn folder before ?
you can
alright, try to install a plugin in your ide
called "maven helper"
with that you can use a built maven in your ide
and launch the commands easily
PS G:\Scramble> ./mvnw clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.example:Scramble >------------------------
[INFO] Building Scramble 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Scramble ---
[INFO] Deleting G:\Scramble\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Scramble ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.11.0:compile (default-compile) @ Scramble ---
[WARNING] *********************************************************************************************************************************************************************************************************************************************************************************
[WARNING] * Required filename-based automodules detected: [twitch4j-1.17.0.jar, twitch4j-chat-1.17.0.jar, twitch4j-common-1.17.0.jar, events4j-core-0.12.1.jar, credentialmanager-0.2.2.jar, events4j-api-0.12.1.jar]. Please don't publish this project to a public artifact repository! *
[WARNING] *********************************************************************************************************************************************************************************************************************************************************************************
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 3 source files with javac [debug target 21 module-path] to target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Scramble ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory G:\Scramble\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.11.0:testCompile (default-testCompile) @ Scramble ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Scramble ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Scramble ---
[INFO] Building jar: G:\Scramble\target\Scramble-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ Scramble ---
[INFO] Installing G:\Scramble\target\Scramble-1.0-SNAPSHOT.jar to C:\Users\user.m2\repository\org\example\Scramble\1.0-SNAPSHOT\Scramble-1.0-SNAPSHOT.jar
[INFO] Installing G:\Scramble\pom.xml to C:\Users\user.m2\repository\org\example\Scramble\1.0-SNAPSHOT\Scramble-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.521 s
[INFO] Finished at: 2023-11-15T02:24:43-08:00
[INFO] ------------------------------------------------------------------------
PS G:\Scramble>
I get the same error after doing mvnw clean install
ah yu did it
now run the app
your project compiles
does it work now ?
hmm
I uploaded your attachments as Gist.
that means you have a runtime exception
but this error is strange ClassNotFoundException
it indicates that ProxyConfig is not available
id suggest you to update the dependencies
last version is 1.18
do you follow Documentation ?
yes
link pls
Welcome and thanks for using Twitch4J!
what's the guide you're using to implement the bot
That website
which page
I put the pieces together
oh it looks like they updated it
it was 1.17.0 earlier
getting-started/installation
getting-started/client-builder
I did
no changes ?
same error
did you start the project from scratch or got it from somewhere ?
scratch
can you tell me when was that ,
alright,
what i suggest now is to go to their discord
why ?
they said this "I would create a shaded jar & run directly from the command line"
they linked me here
I dont know how to do that though
Im trying out eclipse ide

@sinful plover might aswell go for intellij ( it has a free community edition ), most java devs will advice that one over eclipse
