#AudioClip giving exception

1 messages ยท Page 1 of 1 (latest)

split rune
#

i am trying to read a file "Applause-Yannick_Lemieux.wav". but it gives an java.lang.IllegalAccessError , and i cant figure out why. javafx 20.0.2 and java 17.0.6. for the mooc btw

quasi cryptBOT
#

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

quasi cryptBOT
#

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.

split rune
quasi cryptBOT
split rune
#

this is the full exception

#

there is a file in part14-Part14_08.Hurray called Applause-Yannick_Lemieux.wav

tiny birch
#

file:Applause-Yannick_Lemieux.wav

#

you don't need the file:

#

just the path to the file

split rune
#

oh mooc used the file in an example

#

still same exception

tough crater
#

try using java 20 with javafx 20?

#

thats all I can think of

split rune
#

jdk i should download right?

tough crater
#

yes

#

you can do it through intellij

split rune
#

ok downloading rn

umbral snow
#

also where is the file located?

split rune
#

#1146755827689070632 message

split rune
split rune
# tough crater try using java 20 with javafx 20?

no it doesnt work java.lang.UnsupportedClassVersionError: hurraa/HurraaSovellus has been compiled by a more recent version of the Java Runtime (class file version 64.0), this version of the Java Runtime only recognizes class file versions up to 61.0

barren sigil
split rune
#

i am using an ide

#

intellij

#

sdk-temurin-20, language level-sdk default

#

maybe i also need to download temurin jre 20?

barren sigil
barren sigil
# split rune

And this error happens because you put the lib in the classpath instead of the modulepath

#

Are you using maven or gradle?

split rune
split rune
#

also i gtg for like 10-15 mins i will be having lunch

#

ok i am back

split rune
umbral snow
#

again where is that file located?

split rune
#

There is a folder, which contains the pom.xml, and the file is there

barren sigil
split rune
#

It was in the mooc exercise before i did anything

#

I didnt know it was maven

barren sigil
#

How did you add javafx ?

split rune
#

go to project structure-> libraries->click the "+" and then go to my javafx lib folder, then edit the vm configurations to include javafx

#

also i gtg now i am going to the beach

barren sigil
#

And share your pom please

split rune
#

It has worked in the past with javafx, and i will tomorrow because rn it is late for me

quasi cryptBOT
#

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 ๐Ÿ‘

split rune
#

ok i am back

#

removed the libraru

quasi cryptBOT
split rune
#

my pom.xml

#

should i also remove the custom vm configs?

barren sigil
split rune
#

i removed it from the project structure

#

didnt touch the pom.xml

barren sigil
#

ah my bad

#

right

split rune
#

well what do i do now

barren sigil
#

now try to run it

split rune
#

i am playing btd6 rn i will do it later

split rune
#

java: package javafx.application does not exist

#

it gives this error while compiling

#

also every import is red

#

and no javafx in "external libraries"

split rune
barren sigil
#

how do you run it ?

split rune
#

em green arrow button

#

"current file" next to it

barren sigil
barren sigil
#

so

#

click on the little arrow

#

and create a run configuration

split rune
#

edit configurations->"+"?

#

and then click application?

barren sigil
split rune
#

doesnt have maven

#

maybe i need to activate some plugin?

#

i disabled some for perfomance

barren sigil
#

intellij should have maven support by default ๐Ÿค”

split rune
#

well when i downloaded it it had like 80 plugins and was taking too much ram

#

so i disabled some

barren sigil
#

80 plugins ๐Ÿค”

#

try to see if you can find maven

split rune
#

i found it

#

restarting intellij rn

#

now it has maven

#

what do i do now?

barren sigil
#

try to run current file

#

well no

#

first

#

right click the pom

#

then maven should be here

#

then reload project

split rune
#

wait tmc startup actions

split rune
barren sigil
#

show a screenshot please

split rune
#

i cant

barren sigil
#

of the context menu

split rune
#

when i click another app(snipping tool) the thing that appeared after clicking right click on the pom.xml

#

disappears

barren sigil
#

add a timer of the screenshot

split rune
#

also random thing the new UI is way better than the old one

#

what do i do now?

barren sigil
split rune
#

ah no the imports are still red

#

one minute it is downloading something

#

nope

#

downloaded for like 4 mins

#

then still errors

#

still error imports

barren sigil
#

right click on the pom

#

click on maven

#

reload maven project

split rune
#

it did

#

nothing changed

barren sigil
#

at the right on intellij

#

there should be a maven button

split rune
#

yes

#

there is

#

what do i do now

barren sigil
#

click on it

#

and show what appear

split rune
barren sigil
#

show profiles

split rune
barren sigil
split rune
#

now refresh project?

barren sigil
split rune
#

yes

#

and?

barren sigil
#

show what is here

#

there should be a javafx:run

split rune
#

there is only Lifecycle, plugins and dependencies

#

i looked in plugins-> javafx and there is javafx:run there

#

do i double click on it?

barren sigil
#

yes

split rune
#

package javafx.scene.media does not exist

#

it gives this error

barren sigil
#

well yes, it's not in the pom

#

is mooc asking you to use it ?

split rune
#

what? the pom? no

#

javafx yes

#

this is the first time javafx is not working

barren sigil
#

wdym

split rune
#

i have used javafx in 10+ exercise without using it with maven

barren sigil
#

is mooc asking you to use javafx.scene.media ?

split rune
#

yes

#

for AudioClip

#

AudioClip package is javafx.scene.media.AudioClip

#

only way mooc taught to play sounds

barren sigil
#

line 110 of the pom

#

you have several dependencies

split rune
#

ok

barren sigil
#

like javafx-base

split rune
#

yes

barren sigil
#

jor javafx-control

#

try to add javafx-media

#
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-media</artifactId>
    <version>11.0.2</version>
</dependency>
split rune
#

like add this

<dependency>
                    <groupId>org.openjfx</groupId>
                    <artifactId>javafx-media</artifactId>
                    <version>11.0.2</version>
                </dependency>
``` under 
<dependency>
                    <groupId>org.openjfx</groupId>
                    <artifactId>javafx-controls</artifactId>
                    <version>11.0.2</version>
                </dependency>
barren sigil
#

yes

split rune
#

ok

barren sigil
#

now try again

split rune
#

ide gives error

barren sigil
#

which error ?

#

ah

#

right click on pom

#

maven

#

reload project

#

do that each time you edit the pom

split rune
#

oh it works

#

ahhh

#

still errors in main class

barren sigil
#

like ?

split rune
#

maybe i need to do javafx:run again?

barren sigil
#

which version of java are you using ?

split rune
#

17

#

should i use 20

barren sigil
split rune
#

Process exited with an error: 1 (Exit value: 1)

#

let me try with java 20

barren sigil
barren sigil
split rune
split rune
barren sigil
barren sigil
split rune
#

ok

#

second jdk i download for 1 exercise

barren sigil
split rune
#

the last time it didnt work

#

ok currently running the installer

#

currently intellij is indexing jdk

#

same error

barren sigil
#

show the error

split rune
#

Process exited with an error: 1 (Exit value: 1)

#

whole thing

barren sigil
#

no

#

that's not the whole thing

split rune
barren sigil
split rune
#

rerun?

barren sigil
#

?

#

the text

#

at the left

#

of the screenshot

split rune
#

ah here it is

quasi cryptBOT
split rune
#

the error had to be in a file because of discord message size limitations

barren sigil
#

that's run ?

#

what about the one above ?

split rune
quasi cryptBOT
split rune
#

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[ERROR] Command execution failed.

barren sigil
split rune
#

the one that has 2 sec,924 ms nxt to it in my screenshot?

barren sigil
#

yes

split rune
quasi cryptBOT
barren sigil
split rune
#

11

barren sigil
#

because the errors suggests that you are using java 8 or lower ๐Ÿค”

split rune
#

what

#

i dont even have anything lower than java 8

#

in mc moding i had a problem where my project used jdk 17

#

but gradle used jdk 8

#

and i had to change it

#

then it worked

#

but maven doesnt have a way to set a jdk for it

barren sigil
#

open the console and enter java -version

split rune
#

atleast that i know of

#

it is 8

#

1.8

#

i have like 10 javas

barren sigil
#

change it

#

to 11

split rune
#

how

barren sigil
#

or after

barren sigil
split rune
#

JAVA_HOME?

#

wait should i put jdk or jre there

barren sigil
#

do echo %JAVA_HOME% please

split rune
#

in terminal?

barren sigil
#

yes

barren sigil
split rune
barren sigil
split rune
#

%JAVA_HOME%

#

that is what it says

barren sigil
#

then open the environment variables please

split rune
#

yes

#

yes now what

barren sigil
#

show what is on path

#

in both user and system

#

and show JAVA_HOME if you find it

split rune
#

in Path user there is no java, in Path system there is a jdk 11, 4 jdk 8 and another jdk

#

oh wait 3 jdk 8 and 1 jre 8

barren sigil
#

wat

#

and about JAVA_HOME ?

split rune
#

java home on user there is java 17, and system java 8

barren sigil
#

right so

#

remove all the java on path

split rune
#

ok

#

i did

barren sigil
#

now create a new variable in user

#

called JAVA_HOME

split rune
#

in user path?

barren sigil
#

no

#

it's a variable

split rune
#

there is a jdk 17 in user JAVA_HOME

barren sigil
#

ah so you already have a java home ?

split rune
#

in user and system yes

barren sigil
#

remove the one from system

split rune
#

cant i just edit the location?

barren sigil
#

remove it

split rune
#

what is the difference from changing the location?

barren sigil
#

wdym

#

you said you have java home in both user and system

split rune
#

yes. java home in system has a jre 8 in it. why delete it and not just change the location in it to a jdk 11+

#

?

barren sigil
#

you shouldn't have two java home

split rune
#

but one is in system and another in user?

barren sigil
#

yes

#

only keep the one in user

split rune
#

but when i was downloading jdk 11 it added itself to the system. why would jdk 11 do that?

barren sigil
#

because you ran the installer

#

you shouldn't run the installer

#

but download java as a zip

split rune
#

why shouldn't i run it?

barren sigil
#

because it does that

#

so please do what I said

split rune
#

ok

#

i did

#

now what

barren sigil
#

did you remove every java from path ?

split rune
#

no java in neither path

barren sigil
#

right so

#

now add java 11 to JAVA_HOME

#

and show what you added

split rune
#

which one

#

system or user

barren sigil
#

what

#

I told you to delete java home from system

#

and you said you did

split rune
#

ah yeah i forgot

split rune
barren sigil
#

yes

#

well

#

no

split rune
#

yes or no

barren sigil
split rune
#

ok

#

now what>

barren sigil
#

and show a screenshot of what you put in java home

split rune
barren sigil
#

right

#

now in path

split rune
#

yes

barren sigil
#

add %JAVA_HOME%\bin

split rune
#

ok i did

#

i hope i didnt delete anything important

split rune
#

user or system?

barren sigil
#

if you only deleted java stuff, you didn't delete anything important

barren sigil
split rune
#

oh ok

split rune
#

but windows works fine so i think i didnt delete anything

#

ok now what

barren sigil
#

click on ok as many times as there are open windows

#

and once everything is closed

#

open a cmd

#

and enter echo %JAVA_HOME%

#

and java -version

split rune
#

C:\Program Files\Eclipse Adoptium\jdk-17.0.6.10-hotspot

#

echo gives this

#

'java' is not recognized as an internal or external command,
operable program or batch file.

#

java gives this

barren sigil
#

show what you put in path variable

split rune
barren sigil
#

did you open a new cmd ?

split rune
#

yes

barren sigil
#

hmm

barren sigil
split rune
#

should i delete it from system path

#

?

barren sigil
#

yes

split rune
#

ok

barren sigil
#

now close again

#

then restart the cmd again

split rune
#

ey java -version works

barren sigil
#

right

#

now restart intellij

split rune
#

gives openjdk version 17.0.6

split rune
barren sigil
split rune
#

ok

#

mc will work right?

#

because it uses java<17

#

for older versions

barren sigil
#

if you need to change your java version

#

now you can simply change JAVA_HOME

#

you don't need to touch path anymore

split rune
#

for mc servers i used the path to the java i wanted to run it instead of java

#

well now what

barren sigil
#

did you restarted intellij ?

split rune
#

yes

barren sigil
#

now try javafx:run again

split rune
#

aadyafafuafuhff same error

#

java is making me go crazy

barren sigil
split rune
quasi cryptBOT
split rune
quasi cryptBOT
split rune
quasi cryptBOT
barren sigil
#

only the top one

split rune
#

all the errors i could find

barren sigil
#

for the error

split rune
#

the latest one is the longest

#

and the one from the top

barren sigil
#

Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'Applause-Yannick_Lemieux.wav'

#

ah it runs ๐Ÿ™‚

#

now fix your code

split rune
#

em what

#

no

#

that was the initial error...

#

that error was the reason i started this thread

barren sigil
#

wait what ?

barren sigil
# split rune

no it wasn't

Caused by: java.lang.IllegalAccessError: class com.sun.media.jfxmediaimpl.NativeMediaManager (in unnamed module @0x264e54a) cannot access class com.sun.glass.utils.NativeLibLoader (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.utils to unnamed module @0x264e54a

split rune
#

oh wait no

#

my code is still like this

#

exact same

barren sigil
#

yea, I don't know why intellij is not able to find it

#

but yet it runs correctly

#

can you screenshot the whole intellij window ?

split rune
#

when i click green arrow button this comes up
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.077 s
[INFO] Finished at: 2023-09-01T15:50:47+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException

#

maybe i need to set a project somewhere

barren sigil
barren sigil
barren sigil
split rune
#

new->maven

#

then just green arrow button again?>

barren sigil
#

there should be a lot of stuff to put

#

I mean

#

a lot of fields

split rune
#

i chose maven

barren sigil
#

yes

#

now many fields should appear at the right

#

take a screenshot please

split rune
#

the top one is application

barren sigil
#

select maven

split rune
#

i did

#

then?

barren sigil
#

now many fields should appear at the right

#

take a screenshot please

split rune
barren sigil
#

in command line

split rune
#

yes

barren sigil
#

select javafx:run

#

it should auto complete

split rune
#

oh it is downloading stuff

#

oh it failed

barren sigil
#

in profile, you can chose java11 but it's not mandatory

split rune
#

[ERROR] No plugin found for prefix 'javafx' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\User.m2\repository), tmc (https://maven.mooc.fi/releases), tmc-snapshots (https://maven.mooc.fi/snapshots), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

barren sigil
split rune
#

autocomplete what

#

it didnt do anything when i select javafx:run

#

maybe i need to reload maven?

split rune
#

what do i need to do now?

barren sigil
split rune
#

nothing

barren sigil
#

wdym

split rune
#

i clicked it, (in the run config), clicked apply, clicked ok and then clicked green arrow button

barren sigil
barren sigil
split rune
split rune
barren sigil
split rune
#

i wrote java then javafx:run showed and i double clicked on it

#

nothing happens?

barren sigil
split rune
#

yes

#

still isnt working

barren sigil
#

try to click on file

#

at the top left

#

invalidate caches and restart

split rune
#

what does that do? am i going to lose something in my other projects?

split rune
#

ok

#

intellij is updating indexes

#

tmc is doing startup actions

#

(i hate that)

#

no it isnt working

#

but the javafx import errors are gone

barren sigil
barren sigil
#

just do be sure

#

that it is the same

split rune
#

[ERROR] No plugin found for prefix 'javafx' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\User.m2\repository), tmc (https://maven.mooc.fi/releases), tmc-snapshots (https://maven.mooc.fi/snapshots), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

split rune
barren sigil
#

try to run from the maven window at the right

#

at least here it works

split rune
#

how

barren sigil
#

like you did before

split rune
#

javafx:run?

barren sigil
#

yes

split rune
quasi cryptBOT
barren sigil
#

please show the error from the top line

#

not the bottom one

split rune
quasi cryptBOT
split rune
#

this is the orignal error again

barren sigil
#

right so

#

Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'Applause-Yannick_Lemieux.wav'

#

as you can see

#

Applause-Yannick_Lemieux.wav is invalid

split rune
#

why

barren sigil
#

it wants an uri

#

not a path

split rune
#

em. i dont get it

barren sigil
#

so try "file:Applause-Yannick_Lemieux.wav"

echo mortar
#

it tried to get its scheme, but that failed. cause there is none

#

the scheme is http here

#

but ur path is missing all of that

#

no scheme, it fails

split rune
echo mortar
#

did the error message change now? please show

split rune
#

[ERROR] No plugin found for prefix 'javafx' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\User.m2\repository), tmc (https://maven.mooc.fi/releases), tmc-snapshots (https://maven.mooc.fi/snapshots), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

#

third time this comes up

barren sigil
#

?

split rune
#

this is the third time this error happened

barren sigil
#

yes

#

and like the 3 other times

#

for now use the maven menu

#

at the right

split rune
#

Caused by: java.lang.IllegalArgumentException: uri.getScheme() == null! uri == 'Applause-Yannick_Lemieux.wav'

#

that is part of the exception

#

i dont think i need to show any more

barren sigil
#

ah

#

like I said

#

try to use what I gave you

#

file:...

#

or try this actually "file://Applause-Yannick_Lemieux.wav"

split rune
#

alathreon, i gtg now, i will be back tomorrow. thanks for all the help

#

if you think of anything post, here and i will just see it tomorrow

quasi cryptBOT
#

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 ๐Ÿ‘

split rune
#

uri.getScheme() == null! uri == 'Applause-Yannick_Lemieux.wav

#

that is the error when running

echo mortar
#

ur supposed to use what ala told u to write instead

split rune
#

file://Applause-Yannick_Lemieux.wav

#

have tried this

echo mortar
#

and...?

split rune
#

didnt work

echo mortar
#

and the error message was...

split rune
quasi cryptBOT
echo mortar
#

if people have to pull everything out ur nose and repeat things constantly, they will just stop helping u all together eventually

echo mortar
#

that error message is the old one

#

use file://Applause-Yannick_Lemieux.wav

#

ur sharing the error message that u get if u write
Applause-Yannick_Lemieux.wav

#

instead of
file://Applause-Yannick_Lemieux.wav

split rune
#

i did use file://Applause-Yannick_Lemieux.wav

#

let me see if reloading maven project helps

echo mortar
#

have u saved the file before running?

split rune
#

doesnt intellij do that like automatically. i remember i only had to save file for eclipse, then i didnt have to for intellij

#

well i went to file->Save all and then run again and that didnt work

#

if i need to do something to fix this, or to do something to give more information, please tell me

tender storm
#

save your project and make a new screenshot , that will help to update it to current day

split rune
#

like file->save all?

tender storm
#

make it save your code and rerun the project

split rune
#

if the file is not saved i have absolutely 0 idea how to save it

#

i even checked out of intellij to see if it is saved

tender storm
#

and your sure u need a uri and not a url ?

#

not sure if this has been mentiond above ( wall of text ) but try to adapt this to your needs :

#
new AudioClip(TestClass.class.getResource("test.mp3").toExternalForm());
echo mortar
#

ur constantly doing this and it always requires 2 ping pongs

split rune
echo mortar
#

cause we don't know what the new error message is, or whether it's still the same

#

then say that please

split rune
#

the problem is different

#

maven isnt detecting the changes

echo mortar
#

has the solution in the comments

#

its what fa said

split rune
tender storm
#

rebuild your project

split rune
#

ok

#

it works now ๐Ÿ™‚

#

thanks everyone

#

especially zabuzard and alathreon