Questions tagged [drjava]

A lightweight IDE for java, designed primarily for students

DrJava is a lightweight development environment for writing Java programs.

It is designed primarily for students, providing an intuitive interface and the ability to interactively evaluate Java code. It also includes powerful features for more advanced users. DrJava is available for free under the BSD License, and it is under active development by the JavaPLT group at Rice University.

For more information and downloads, visit the official site.

188 questions
1
vote
2 answers

How to test for exception in DrJava?

I am starting out in Java using DrJava. I am following TDD for learning. I created a method which is suppose to validate some data and on invalid data, the method is suppose to throw exception. It is throwing exception as expected. But I am not…
Nair
  • 7,438
  • 10
  • 41
  • 69
1
vote
4 answers

Piping (redirecting input from a text file) into a Java program using DrJava

I'm piping a text file into a java program. This is what the text file "input.txt" holds: 4 5 That is, the numbers 4 and 5 in seperated lines. I want the program to read those numbers and print them out. This code should work: public class readFile…
helgso
  • 11
  • 1
  • 5
1
vote
1 answer

Cant import Font in Eclipse but can import in Dr. Java

So i have this code File fontFile = new File("FrizQuadrataTT.ttf");; FileInputStream in = new FileInputStream(f); Font dFont = Font.createFont(Font.TRUETYPE_FONT, in); Font f1 = dFont.deriveFont(15f); Which import a font file called…
Exikle
  • 1,155
  • 2
  • 18
  • 42
1
vote
1 answer

in DrRacket, DrJava, DrPython, what does "Dr" stand for?

Currently there are some IDEs for some programming languages like DrRacket (DrScheme), DrJava and DrPython. Anyone knows What does the prefix "Dr" stand for?
abc0x0h
  • 13
  • 2
1
vote
3 answers

Why won't my for loop stop; despite a boolean expression?

The very last for loop listed (int variables n and o).. I'm very new to any type of programming and in our introductory course we use Dr Java and some Basic media stuff to make what is essentially a turtle pen. It draws things on a display. My last…
Michael MacDonald
  • 413
  • 2
  • 6
  • 17
0
votes
3 answers

NullPointerExcetion Native Method Accessor... Hashing Words Issue

I am writing a project that reads a file and sorts "Words". This code compiles correctly, yet then it gives me a null pointer exception. Any Ideas? import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import…
Bill
  • 145
  • 3
  • 5
  • 13
0
votes
0 answers

Changing specific time variable fields changes whole time variable

So I have a problem where I'm getting a Time type as an input(time). I also receive a number of seconds to increment that time by(seconds). In the first few lines before you see me reference the this variable I am taking the seconds and creating…
0
votes
4 answers

Java. I want to repeat the words in the string, but something goes wrong in my code

I want to repeat only the words in my input string. But the order of output is not right. Here's my code: public static String repeatWords(String s, int num){ StringBuilder sb = new StringBuilder(); StringBuilder sbtemporary = new…
JarvisLYu1
  • 9
  • 1
  • 1
0
votes
0 answers

Dr Java Compiler Issue I think

I've been getting this error in a popup. I can compile but when I try to run it gives me "Current document is out of sync with the Interactions Pane and should be recompiled!" Please tell me how to fix this and how to get my dr.java up and running…
0
votes
0 answers

DrJava-2019-220051 using JDK 7.0_7 as my compiler, even though I have JDK8.0_281 installed

New to DrJava and downloaded Java 8_281. It's been working all day. Under the compiler in DrJava, it even listed JDK 8 as its compiler. Now, all of a sudden, I open my program and the compiler has switched to JDK 7. It now outputs an error message…
0
votes
1 answer

How to check if a number has decimal places to the thousandths place or more?

I am working on a program that prints out the wages earned by workers including overtime pay. I am almost finished with the program. However, I am stuck on how to make a condition to fix the decimals in the wages to only the tenths and hundredths…
0
votes
1 answer

Installing JDK 8_251 but keeps saying 7.0_7

My IDE is DrJava, I am trying to open a previous project but I cant seem to get JDK 8 working. I wiped my computer so I've had to reinstall everything. But whenever I try to install JDK 8, which is what I coded my program in, it keeps saying I…
0
votes
1 answer

Interactions pane unresponsive when I test this code

This is my first post so if there are formatting issues, I'm sorry. So long story short, every time I compile this code in DrJava the interactions pane becomes unresponsive, but the program itself is fine. import java.util.Scanner; import…
0
votes
1 answer

How to create a Constructor that initializes a contact info with the given name and the "given list of phones"

For a homework assignment, part of making the class that we use throughout the assignment requires me to create constructors that follow the guidelines ContactInfo() Default constructor and initializes a contact info with name = “unknown” and an…
0
votes
1 answer

Finding the second largest number of given integers without using array

Using if loops, I am tasked with putting the largest & 2nd largest integers into a pair, and the smallest & 2nd largest integers into a pair, from user provided numbers. I have tried several different if conditions, and while my program can find the…