When I try to run a program I wrote for my Intro to Java class, I get this error:
1 error found:
File: C:\Users\Young\Desktop\cse8wbd\hw1\CSE8ATurtle.java [line: (no source location)]
Error: Internal compiler error: java.lang.NullPointerException at java.lang.String.<init>(Unknown Source)
And this is the code that I have so far:
/*
* Name: Jane-Joe Student <<< --- Replace with Your Name
* Login: cs8wXX <<< --- Use your cs8w course-specific account name
* Date: Month Day, Year
* File: Name of this file, for example: CSE8ATurtle.java
* Sources of Help: ... (for example: names of people, books, websites, etc.)
*
* Describe what this program does here.
*/
import java.awt.Color;
public class CSE8ATurtle extends Turtle
{
private final static int CHAR_WIDTH = 40;
private final static int LINE_WIDTH = 80;
private final static int LINE_SPACE = LINE_WIDTH + 40;
private final static int CHAR_SPACE = CHAR_WIDTH + 40;
private final static int WORLD_WIDTH = 600;
private final static int WORLD_HEIGHT = 400;
public CSE8ATurtle()
{
super(new World(WORLD_WIDTH, WORLD_HEIGHT));
}
private void drawC(int x, int y)
{
penUp(); moveTo (x,y);
turnToFace(getXPos()+1,getYPos());
penDown();
forward(40);
penUp();
backward(40);
turnRight();
penDown();
forward(80);
turnLeft();
forward(40);
}
private void drawS(int x, int y)
{
penUp(); moveTo(x,y);
/* TODO: Complete this part to draw the 'S' */
}
/* TODO: Add any remaining methods to draw all the other characters */
/*
* Name: Class or method name
* Purpose: Briefly describe the purpose of this class or method
* Parameters: List all parameters and their types and what they represent
* If no parameters, just state None
* Return: Specify the return type and what it represents
* If no return value, just specify void
*/
public static void main(String [] args)
{
CSE8ATurtle myTurtle = new CSE8ATurtle();
int startX1 = 10,
startX2 = 10,
startX3 = 10;
int startY = 10;
int x,y;
myTurtle.setPenWidth(10);
myTurtle.setPenColor(Color.BLUE);
myTurtle.drawC(x = startX1, y = startY);
myTurtle.drawS(x += CHAR_SPACE, y);
/* TODO: Complete this main function to draw the remaining text */
}
} //End of public class CSE8ATurtle extends Turtle
Any ideas on how to fix this?
I just downloaded your attached file CSE8ATurtle.java and loaded it into DrJava (I am running DrJava Version : drjava-20100913-r5387). The compiler produced the following error messages:
20 errors found:
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 13]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:13: cannot find symbol
symbol: class Turtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 25]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:25: cannot find symbol
symbol : class World
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 30]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:30: cannot find symbol
symbol : method penUp()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 30]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:30: cannot find symbol
symbol : method moveTo(int,int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 31]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:31: cannot find symbol
symbol : method getXPos()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 31]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:31: operator + cannot be applied to getXPos,int
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 31]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:31: cannot find symbol
symbol : method getYPos()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 32]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:32: cannot find symbol
symbol : method penDown()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 33]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:33: cannot find symbol
symbol : method forward(int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 34]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:34: cannot find symbol
symbol : method penUp()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 35]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:35: cannot find symbol
symbol : method backward(int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 36]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:36: cannot find symbol
symbol : method turnRight()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 37]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:37: cannot find symbol
symbol : method penDown()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 38]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:38: cannot find symbol
symbol : method forward(int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 39]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:39: cannot find symbol
symbol : method turnLeft()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 40]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:40: cannot find symbol
symbol : method forward(int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 45]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:45: cannot find symbol
symbol : method penUp()
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 45]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:45: cannot find symbol
symbol : method moveTo(int,int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 73]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:73: cannot find symbol
symbol : method setPenWidth(int)
location: class CSE8ATurtle
File: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java [line: 74]
Error: /home/cork/Documents/DrJava/Bugs/CSE8A/CSE8ATurtle.java:74: cannot find symbol
symbol : method setPenColor(java.awt.Color)
location: class CSE8ATurtle
I suspect that I am missing some libraries. Can you upload them to this bug report or upload a pointer to a file I can download.
It would also help us track down the bug if you copied the "System Properties" (a tab on the About panel of the Help menu) using the button at the bottom of the panel and uploaded them to this bug report.
Thanks!
We need to know a little bit more about your system to help you. Please go to "Help -> About" on the menu and click on "System Properties". Then, click the "Copy System Properties" button and paste the results here in a new comment.
Thanks,
The DrJava Team
System Properties:
DrJava Version drjava-20100913-r5387
DrJava Build Time 20100913-2126
drjava.debug.port = 49219
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = C:\Program Files (x86)\Java\jre6\bin
java.vm.version = 19.0-b09
java.vm.vendor = Sun Microsystems Inc.
java.vendor.url = http://java.sun.com/
path.separator = ;
java.vm.name = Java HotSpot(TM) Client VM
file.encoding.pkg = sun.io
sun.java.launcher = SUN_STANDARD
user.country = US
sun.os.patch.level =
java.vm.specification.name = Java Virtual Machine Specification
user.dir = <anonymized user.home>\Desktop
java.runtime.version = 1.6.0_23-b05
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs = C:\Program Files (x86)\Java\jre6\lib\endorsed
os.arch = x86
java.io.tmpdir = <anonymized user.home>\AppData\Local\Temp\ line.separator = "\u000d\u000a"
java.vm.specification.vendor = Sun Microsystems Inc.
user.variant =
os.name = Windows 7
sun.jnu.encoding = Cp1252
java.library.path = C:\Program Files (x86)\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Java\jre6\bin
java.specification.name = Java Platform API Specification
java.class.version = 50.0
sun.management.compiler = HotSpot Client Compiler
os.version = 6.1
user.home = <anonymized user.home>
user.timezone = America/Los_Angeles
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = Cp1252
java.specification.version = 1.6
java.class.path = <anonymized user.home>\Desktop\drjava-stable-20100913-r5387.exe
user.name = <anonymized user.name>
java.vm.specification.version = 1.0
java.home = C:\Program Files (x86)\Java\jre6
sun.arch.data.model = 32
user.language = en
java.specification.vendor = Sun Microsystems Inc.
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode, sharing
java.version = 1.6.0_23
java.ext.dirs = C:\Program Files (x86)\Java\jre6\lib\ext;C:\Windows\Sun\Java\lib\ext
sun.boot.class.path = C:\Program Files (x86)\Java\jre6\lib\resources.jar;C:\Program Files (x86)\Java\jre6\lib\rt.jar;C:\Program Files (x86)\Java\jre6\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jre6\lib\jsse.jar;C:\Program Files (x86)\Java\jre6\lib\jce.jar;C:\Program Files (x86)\Java\jre6\lib\charsets.jar;C:\Program Files (x86)\Java\jre6\lib\modules\jdk.boot.jar;C:\Program Files (x86)\Java\jre6\classes
java.vendor = Sun Microsystems Inc.
file.separator = \ java.vendor.url.bug = http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
java.rmi.server.hostname = 127.0.0.1
sun.desktop = windows
sun.cpu.isalist = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86
DrJava configuration file
In resource bundle edu.rice.cs.drjava.config.options:
nothing
In shadowed configuration:
extra.classpath = C:\\Users\\<anonymized user.name>\\Desktop\\cse8wbd\\hw1\\bookClasses;C:\\Users\\<anonymized user.name>\\Desktop\\cse8wbd\\hw1\\bookClasses
key.delete.next = [shift DELETE]
key.delete.previous = [shift BACK_SPACE]
save.before.compile = true
recent.files = [C:\\Users\\<anonymized user.name>\\Desktop\\cse8wbd\\hw1\\CSE8ATurtle.java,C:\\Users\\<anonymized user.name>\\Downloads\\CSE8ATurtle (1).java,C:\\Users\\<anonymized user.name>\\Downloads\\CSE8ATurtle.java,C:\\Users\\<anonymized user.name>\\Desktop\\cse8wbd\\hw1\\bookClasses\\CSE8ATurtle.java,C:\\Users\\<anonymized user.name>\\Desktop\\CSE8ATurtle.java]
window.height = 1026
window.width = 1696
window.x = -8
window.y = -8
window.state = 6
doc.list.width = 178
last.dir = C:\\Users\\<anonymized user.name>\\Desktop\\cse8wbd\\hw1\\CSE8ATurtle.java
last.interactions.dir = C:\\Users\\<anonymized user.name>\\Desktop\\cse8wbd\\hw1
tabbedpanes.state = 840 525 700 400
dialog.drjava.survey.enabled = false
new.version.notification.last = 1294789270480
drjava.survey.notification.last = 1294972617119
drjava.survey.result.last = http://www.drjava.org/submit-usage.php?rev=5387&os.name=Windows%207&os.version=6.1&java.version=1.6.0_23&java.vendor=Sun%20Microsystems%20Inc.
file.ext.registration = always
Used memory: about 35.66 megabytes
Free memory: about 36.74 megabytes
Total memory: about 72.41 megabytes
Total memory can expand to: about 247.50 megabytes
Number of processors/cores: 4
Compiler Discovery Log:
From config: not set
makeFromRuntime: compilerAdapter=edu.rice.cs.drjava.model.compiler.Javac160Compiler
attempt = JDK 6.0_23, isAvailable() = false
compiler=edu.rice.cs.drjava.model.compiler.NoCompilerAvailable
at least Java 6, try EclipseCompiler
version for Eclipse: Java 6.0
attempt = Eclipse Compiler 0.A48, isAvailable() = true
compiler=edu.rice.cs.drjava.model.compiler.EclipseCompiler
compiler found
compilers found: 1
From runtime: JDK library 6.0
Dir added: C:\Program Files (x86)\Java\jre6
Dir added: C:\Program Files (x86)\Java
Dir added: C:\Program Files (x86)
Dir added: C:\Program Files (x86)\Java
Dir added: C:\Program Files (x86)
Dir not added: C:\Program Files\Java
Dir added: C:\Program Files
Dir not added: C:\Java
Dir added: <anonymized user.home>\Desktop
Dir not added: C:\Java
Dir added: <anonymized user.home>\Desktop
Dir not added: C:\System\Library\Frameworks\JavaVM.framework\Versions
Dir not added: C:\usr\java
Dir not added: C:\usr\j2se
Dir not added: C:\usr
Dir not added: C:\usr\local\java
Dir not added: C:\usr\local\j2se
Dir not added: C:\usr\local
Dir not added: C:\usr\lib\jvm
Dir not added: C:\usr\lib\jvm\java-6-sun
Dir not added: C:\usr\lib\jvm\java-1.5.0-sun
Dir not added: C:\usr\lib\jvm\java-6-openjdk
Dir not added: C:\home\javaplt\java\Linux-i686
File not added: C:\Program Files (x86)\Java\lib\tools.jar
File not added: C:\Program Files (x86)\Java\Classes\classes.jar
File not added: C:\Program Files\JavaMint\langtools\dist\lib\classes.jar
File not added: C:\Program Files\JavaMint\langtools\dist\lib\tools.jar
File not added: C:\usr\local\soylatte\lib\classes.jar
File not added: C:\usr\local\soylatte\lib\tools.jar
File not added: C:\usr\local\JavaMint\langtools\dist\lib\classes.jar
File not added: C:\usr\local\JavaMint\langtools\dist\lib\tools.jar
MINT_HOME not set
File added: <anonymized user.home>\Desktop\drjava-stable-20100913-r5387.exe
Result:
And here's the link to download the required files:
https://docs.google.com/leaf?id=0BwzkIllZPG6mZjgyZTFkMDMtZTY5MS00YWNhLWIxYjYtZGQ0NzMzZDYyZTc4&hl=en&authkey=CMLg_eoF
Sorry for the double post, I'm not sure how to edit my previous post.
After downloading the bookClasses.rar file, unpacking it and adding the jar files and the bookClasses directory to the class path, the file almost compiles. There is one error:
1 error found:
File: D:\Documents\drjava\samples\bookClasses\Turtle.java [line: 22]
Error: D:\Documents\drjava\samples\bookClasses\Turtle.java:22: cannot access Picture
bad class file: D:\Documents\drjava\samples\bookClasses\Picture.java
file does not contain class Picture
Please remove or make sure it appears in the correct subdirectory of the classpath.
The Picture.java class is empty. Can you download a fresh copy of the bookClasses, either from your course website or from Georgia Tech? http://home.cc.gatech.edu/TeaParty/47