#Coursera its a Princeton computer science: Programming with a purpose class need help
47 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @round rain! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
You appear to be trying to run a Java 11 class with Java 7
I'm not sure what Java version you're course is using, but I'd assume it's 11 since that's what the stdlib file is made for
its drjava all ik
So what'd you need to do is get a java 11 JDK installed on your PC
ok
There are a couple different distributions but I like to use Temurin: https://adoptium.net/temurin/releases/?version=11&package=jdk
which version should i dl any
ok i downloaded it
ok its a folder right
do i put it somewhere
https://adoptium.net/temurin/releases/?version=11&package=jdk&os=windows&arch=x64
(assuming x86_64 CPU)
Grab the MSI
It's an installer which will help you
The zip is for a manual install
Yes and make sure to reopen the terminal
public class BouncingBall {
public static void main(String[] args) {
// set the scale of the coordinate system
StdDraw.setXscale(-1.0, 1.0);
StdDraw.setYscale(-1.0, 1.0);
StdDraw.enableDoubleBuffering();
// initial values
double rx = 0.480, ry = 0.860; // position
double vx = 0.015, vy = 0.023; // velocity
double radius = 0.05; // radius
// main animation loop
while (true) {
// bounce off wall according to law of elastic collision
if (Math.abs(rx + vx) > 1.0 - radius) vx = -vx;
if (Math.abs(ry + vy) > 1.0 - radius) vy = -vy;
// update position
rx = rx + vx;
ry = ry + vy;
// clear the background
StdDraw.clear(StdDraw.LIGHT_GRAY);
// draw ball on the screen
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledCircle(rx, ry, radius);
// copy offscreen buffer to onscreen
StdDraw.show();
// pause for 20 ms
StdDraw.pause(20);
}
}
} ```
This message has been formatted automatically. You can disable this using /preferences.
does this look correct
im going to uninstall and read install it becouse its not working and i got errors install drjava even though that shouldn't matter but so i can explain everything in detail im a semi quad so please give me time thanks
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
I've never used DrJava so I can't really help you with that
Were there any instructions in the course for how to get everything installed?
yes
one sec im using drjava i guess to compile it and its giving errors
10 errors found:
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 5]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 6]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 7]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 26]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 26]
Error: StdDraw cannot be resolved to a variable
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 29]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 29]
Error: StdDraw cannot be resolved to a variable
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 30]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 33]
Error: StdDraw cannot be resolved
File: C:\Users\there\introcs\Hello\BouncingBall.java [line: 36]
Error: StdDraw cannot be resolved
ill be back tomorrow
Well that interesting, I wonder why it's telling you to install Java 7 if the stdlib is made for Java 11 🤷♂️
This DrJava-based Java programming environment is no longer being supported (because DrJava in no longer being actively developed and DrJava is incompatible with Java 11). It has been replaced by the following IntelliJ-based programming environment for Windows.
also there's this note
I will let someone else help you
ok thanks for the help seriously
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
broooooo