G
G
Gfd2015-12-16 19:04:33
Java
Gfd, 2015-12-16 19:04:33

Stream error?

I've only been learning java for 2 weeks, and please don't criticize me for such a stupid question
package application;
import java.io.File;
import java.util.Scanner;
import javafx.fxml.FXML;
import jfxtras.labs.scene.control.gauge.linear.SimpleMetroArcGauge;
class pussy implements Runnable{
@FXML
public SimpleMetroArcGauge Time;
String timeS;
double timeD;
long time;
Scanner scan;
@Override
public void run() {
try{
scn=new Scanner(new File("src//application//res//Re//TemporaryTimeStart.txt"));
}catch(Exception e){}
while(scn.hasNext()){
timeS=scn.nextLine();
}
scn.close();
timeD=Double.parseDouble(timeS);
time=(long)timeD;
for(int row=0;row<5;row++){
Time.setValue(Time.getValue()+0.5);
}
try {
Thread.sleep((long) time);
} catch (Exception e) {}
}
}
Here is the start of the thread:
if(ChoiceRe.getText()=="Normal"){
System.out.println("Normal mode started");
normalTime = normalTime/100;
normalTime=normalTime*60;
normalTime=normalTime*1000;
TimeStart=Double.toString(normalTime);
try {
x=new Formatter("src//application//res//Re//TemporaryTimeStart.txt");
x.format(TimeStart);
} catch (FileNotFoundException e) {}
x.close();
Thread t1=new Thread(new pussy());
t1.start();
}
The compiler throws an error
Exception in thread "Thread-4" java.lang.NullPointerException
at application.pussy.run(pussy.java:29)
at java.lang.Thread.run(Unknown Source)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question