Enviado em 10/10/2021 - 16:30h
É o seguinte, estou tentando fazer um projeto javaFX que toca uma música do meu pc e sorteia números aleatórios com a mensagem "Hacking NASA" + numeroAleatorio.package com.example.demo1;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import java.io.File;
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class HeckerVibes {
public static void main(String[] args) throws InterruptedException {
Random r = new Random();
int y = r.nextInt(25);
audio();
System.out.println("Hacking NASA... " + y + "%");
y = r.nextInt(50);
while(y < 25){
y = r.nextInt(50);
}
System.out.println("Hacking NASA... " + y + "%");
int h = r.nextInt(5) + 1;
TimeUnit.SECONDS.sleep(h);
y = r.nextInt(75);
while(y < 50){
y = r.nextInt(75);
}
System.out.println("Hacking NASA... " + y + "%");
h = r.nextInt(5) + 1;
TimeUnit.SECONDS.sleep(h);
y = r.nextInt(100);
while(y < 75){
y = r.nextInt(100);
}
System.out.println("Hacking NASA... " + y + "%");
h = r.nextInt(5) + 1;
TimeUnit.SECONDS.sleep(h);
System.out.println("Hacking NASA... 99%");
TimeUnit.SECONDS.sleep(1);
System.out.println("NASA hacked");
}
public static void audio(){
String kimo = "~/Music/musica.mp3";
Media hit = new Media(new File(kimo).toURI().toString());
MediaPlayer media = new MediaPlayer(hit);
media.play();
}
}
'javafx.media'na seção modules, isso não parece ser o erro.
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
O macete do Warsaw no Linux Mint e cia
Visualizar arquivos em formato markdown (ex.: README.md) pelo terminal
Dando - teoricamente - um gás no Gnome-Shell do Arch Linux
Como instalar o Google Cloud CLI no Ubuntu/Debian
Mantenha seu Sistema Leve e Rápido com a Limpeza do APT!
Procurando vídeos de YouTube pelo terminal e assistindo via mpv (2025)
debian com wayland, configuracao de teclado. Mudou Tudo! [RESOLVIDO] (1)
Iinstalar o Scanner Kodak i940 no Linux Mint 19/20? (4)
Pastas da raiz foram para a área de trabalho [RESOLVIDO] (11)