just got some Problem when using program-snippets that are using Exeptions.
For Example:
- Code: Select all
import lejos.nxt.*;
public class BatteryTester {
public static void main(String[] args) throws Exception {
LCD.drawString("Battery: " + Battery.getVoltage() + " Volt", 0, 0);
LCD.drawString("Battery: " + Battery.getVoltageMilliVolt() + " mVolt", 0, 1);
Thread.sleep(5000);
}
}
When trying to compile i always get:
- Code: Select all
Compiliere C:\java-src\BatteryTester.java mit Java-Compiler (Mindstorms-Modus)
.\Exception.java:1:1: class or interface expected
try {
^
.\Exception.java:6:5: class or interface expected
throw e; //Leite nach oben weiter
^
.\Exception.java:7:1: class or interface expected
} catch (Exception e) {
^
.\Exception.java:10:1: class or interface expected
} catch (OutOfMemoryError e) {
^
.\Exception.java:13:1: class or interface expected
} catch (Throwable t) {
^
.\Exception.java:16:1: class or interface expected
} finally {
^
.\Exception.java:19:1: class or interface expected
}
^
BatteryTester.java:4:51: cannot access Exception
bad class file: .\Exception.java
file does not contain class Exception
Please remove or make sure it appears in the correct subdirectory of the classpath.
public static void main(String[] args) throws Exception {
^
Thanks in advance for your help.
