问题标签 [drjava]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
4920 浏览

java - 包 org.pdfbox.cos 不存在

我正在尝试导入和使用 PDFBox,但在安装我相信的 jar 时遇到问题。

我正在使用 Dr. Java,并且已将 pdfbox-1.8.6.jar 和 pdfbox-app-1.8.6.jar 添加到我的 Extra Classpath 中的资源位置。

但是,当我运行代码时,它仍然无法识别罐子:

为了使罐子工作,我还需要执行哪些其他步骤?

0 投票
0 回答
544 浏览

eclipse - Problems with DrJava's interactions pane, eclipse plug-in

I am using DrJava's plugin for Eclipse (4.3), and the interactions pane "view" is acting funny. (Very similar to this guy from 2011). Unfortunately, his question has no responses.

I also found this, however it's from 2004, and hasn't solved my problem.

DrJava refuses to acknowledge or instantiate objects, even though it throws no error.

I'm not sure why this happens, as it does not give an error on the import.

I also tried this:

To be sure it was a problem with the plug in, and not java itself, I entered the same code into the interactions pane in drjava (20130901-r5756). It worked as expected here:

So I have two questions:

  1. How can I fix the plug-in not acknowledging the creation of objects?
  2. Is there anyway to change the working directory in the plugin? I've only found this possible in Dr.Java IF a new Project is created, or under Preferences -> Resources -> Extra ClassPath. This is because I have different projects in different folders, and I'd like to test the classes, but I can't change my classpath to their location.

This is my first post on SO, please let me know if this questions needs any edits, or is not clear enough.

Thanks.

0 投票
1 回答
52 浏览

java - 如何使程序在不重置的情况下使用不同的变量?

我的问题通常是如何在不重置它的情况下使这个程序工作?我是新手,我想以某种方式循环扫描仪功能,让用户能够在一段时间内为华氏温度输入几个变量,而无需重置整个代码。

提前致谢

0 投票
2 回答
58 浏览

java - 循环没有给出想要的结果,卡住了

我正在尝试打印出Vusing *. 不知何故,当我运行代码时,它会在同一行打印出 2 个单星。我被困在这个问题上,我似乎无法找出我应该如何传播给定的信息。我使用Scanner输入一个数字,表示V应该有什么高度。

0 投票
2 回答
1083 浏览

java - Java 中的提示计算器帮助?

我收到这些错误:发现 3 个错误:[行:5] 错误:缺少方法主体,或声明抽象 [行:15] 错误:找不到符号符号:变量 subTotal 位置:类 TipCalc [行:17] 错误:找不到符号符号:变量子总位置:类TipCalc 我刚开始学习Java。我对出了什么问题感到困惑。有什么建议吗?

0 投票
1 回答
324 浏览

java - 'in' 永远不会关闭

我的代码中有一个错误,它给了我一个警告

警告:资源泄漏:'in' 永远不会关闭

我以前从未遇到过这个问题,实际上我尝试了我编写的旧程序,但它仍然给我同样的问题。我该如何解决 ?

0 投票
1 回答
34 浏览

recursion - 递归有问题。为什么在我的驱动程序中运行此方法时编译但崩溃?

//采用 int 的递归方法,打印该数量的星星。//我知道第一个 if 语句不是正确的 java 格式,但是将 nStars(n) 与 factorial = (n-1) 放在同一行会在编译时给我一个错误。

0 投票
2 回答
1354 浏览

java - “非法类文字”是什么意思?

刚开始使用 DrJava,当我尝试运行我的代码时遇到 Illegal Class Literal 错误。我的代码可以编译,直到运行时才会出现问题。当我在交互终端中运行“java Percolation(5)”时,即使是以下内容也会导致错误。

我在谷歌上找不到任何东西;有什么想法吗?我觉得我错过了一些愚蠢的东西。谢谢!

0 投票
1 回答
61 浏览

java - 如何确定 DrJava 正在执行哪些命令?

:当我点击“编译”时,如何确定 DrJava 实际执行了哪些命令?

上下文:我编写了一个使用外部 .jar 的简单测试程序。我通过 Edit > Preferences > Resource Locations > Extra Classpath > Add 在 DrJava 中添加了该 .jar 的路径。我想知道javacDrJava 实际上是如何调用的。例如,是不是

javac -cp <path to the .jar> myprogram.java或者

javac -cp .;<path to the .jar> myprogram.java或者是其他东西?

0 投票
2 回答
515 浏览

java - 为什么我在编译期间收到 NullPointerException?

您好,我目前正在为我的 Java 编程课程的考试做作业。现在我正试图让这个程序运行没有错误。谁能帮我理解我做错了什么?我有这段代码,但遇到了 NullPointerException:

java.lang.NullPointerException 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 在 java.lang.reflect.Method。在 edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272) 调用(未知来源)