#what is this error and how do I fix it?

1 messages · Page 1 of 1 (latest)

sinful plover
#
java: com.github.twitch4j.common.events.domain.EventChannel.getName() in package com.github.twitch4j.common.events.domain is not accessible
  (package com.github.twitch4j.common.events.domain is declared in the unnamed module, but module org.example.scrambler does not read it)```
cloud daggerBOT
#

<@&987246399047479336> please have a look, thanks.

cloud daggerBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

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.

sinful plover
#

somebody help

sacred spear
#

what are you building ?

sinful plover
#

can you help me?

sacred spear
#

the one called HelloController.java

sinful plover
#

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");
    }



}```
cloud daggerBOT
# sinful plover ```package org.example.scrambler; import com.github.philippheuer.credentialmana...

Detected code, here are some useful tools:

Formatted code
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");
  }
}
cloud daggerBOT
#

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 👍

sinful plover
#

can someone help me?

sacred spear
sinful plover
#

hi!

#

whats up

sacred spear
#

do you have a module-info.java file ?

sinful plover
#

yes

#

thats the problem I think

sacred spear
#

show its code pls

sinful plover
#
    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;
}```
cloud daggerBOT
sacred spear
#

you need to add this

#

requires com.github.twitch4j.common;

#

i think

sinful plover
#

I tried that before

sacred spear
#

do it now

sinful plover
cloud daggerBOT
sinful plover
#

thats the error I get after I put that in

#

System.out.println("[" + e.getChannel().getName() + "] " + e.getUser().getName() + ": " + e.getMessage());

sacred spear
#

these are other issues

sinful plover
#

right here is the problem

#

something is wrong with .getName()

#

.getMessage() works fine

cloud daggerBOT
sacred spear
#

dnt use getName()

#

for now

sinful plover
#

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());
        });```
cloud daggerBOT
sinful plover
#

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

cloud daggerBOT
sinful plover
#

this is the error

sacred spear
#

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

#

🤷‍♂️

sinful plover
#

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

sacred spear
#

sounds like ProxyConfig class is not there

#

maybe you're not using the right version of the library

sinful plover
#

I dont know how dependencies work

sacred spear
#

check your pom.xml

sinful plover
#
      <groupId>com.github.twitch4j</groupId>
      <artifactId>twitch4j</artifactId>
      <version>1.17.0</version>
    </dependency>```
cloud daggerBOT
sinful plover
#

I googled the error

#

and this is what comes out

sacred spear
#

alright, so this dependency is new to your project now ?

sinful plover
#

no I added it when I first started it

sacred spear
#

did u update the project with mvn update ?

sinful plover
#

yes

sacred spear
#

alright, did u try clean install ?

sinful plover
#

clean install?

sacred spear
#

mvn clean install

#

to be sure it compiles

sinful plover
#

I dont know what that is

sacred spear
#

it"s a command

#

./mvnw clean install

#

run it

sinful plover
#

do I do that in command prompt?

sacred spear
#

in terminal

sinful plover
#

in here?

sacred spear
#

in your IDE

#

there is a tab below

#

Terminal

sinful plover
#

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

sacred spear
#

which command did u use here ?

sinful plover
#

./mvnw clean install

sacred spear
#

and you have java installed right ?

sinful plover
#

yes

#

I should have it installed

sacred spear
#

then why u dnt possess a java homd env variable ?

sinful plover
#

wait I dont know if I downloaded java

#

I just installed intelliJ

sacred spear
#

you have to install java dude !

sinful plover
sacred spear
#

that must be embedded with ide

sinful plover
#

it is I believe

sacred spear
#

that way you can't run the mvn command :/

#

you need java installed

sinful plover
sacred spear
#

from oracle

#

or openjdk

sinful plover
#

JDK 21?

sacred spear
#

or 17 as u like

sinful plover
#

is there a big difference?

sacred spear
#

nah

#

both are reliable

sinful plover
#

ok installing it

#

ok done

sacred spear
#

~~reopen ~~ restart your IDE

sinful plover
#

okay

sacred spear
#

in terminal run the following
java --version

sinful plover
#

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>

sacred spear
#

ok now run the ./mvnw clean install

sinful plover
#

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?

sacred spear
#

you have to set it manually in your operating system

sinful plover
#

okay

sacred spear
#

i thought that it's done automatically :/

sinful plover
#

let me google it

#

Im not sure how to do it

stoic finch
sinful plover
#

I used the bin not the msi

sacred spear
#

if you're on Windows

#

you enter in /C: > program files > java

#

you'll find the jdk directory

#

copy the path

sinful plover
#

its in my G drive

#

G:\Java\

#

like this?

sacred spear
#

jdk 1.8 ?

#

👀

sinful plover
#

well tahts the example

sacred spear
#

try to dit with UI pls

#

go to search > write "env variables"

sinful plover
#

ok I see the google

sinful plover
#

ok I think I did it

#

let me restart ide

sacred spear
sinful plover
#

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>

sacred spear
#

you are missing a folder :/

sinful plover
sacred spear
#

how did you create this project ?

sinful plover
#

I got this warning when I restart IDE

sacred spear
sinful plover
#

Using new project and javafx

sacred spear
#

did you delete .mvn folder before ?

sinful plover
#

no

#

do I have to set the jdk to the one I downloaded?

sacred spear
#

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

sinful plover
#

the top one?

sinful plover
#

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

sacred spear
#

now run the app

#

your project compiles

sinful plover
#

I did

#

I recreated the code using java jdk from oracle

sacred spear
sinful plover
#

no

sacred spear
#

hmm

cloud daggerBOT
sacred spear
#

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

sinful plover
#

I updated same error

#

does this mean anything?

sacred spear
#

do you follow Documentation ?

sinful plover
#

yes

sacred spear
#

link pls

sinful plover
sacred spear
sinful plover
#

That website

sacred spear
#

which page

sinful plover
#

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

sacred spear
#

¯_(ツ)_/¯

#

then make an update and retry

sinful plover
#

I did

sacred spear
sinful plover
#

same error

sacred spear
#

did you start the project from scratch or got it from somewhere ?

sinful plover
#

scratch

sacred spear
#

can you tell me when was that ,

sinful plover
#

a few days ago

#

maybe 3-7 days ago

sacred spear
#

what i suggest now is to go to their discord

sinful plover
#

I did go to their discord

#

they could not help me

sacred spear
sinful plover
#

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

sinful plover
#

I think it might be the IDE

#

its very late

#

I will work on it tomorrow

sinful plover
#

Im trying out eclipse ide

sacred spear
feral gorge
#

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