Menu

#310 "Current document is out of sync with the Interactions Pane" on EVERY program

v1.0 (example)
open
nobody
errors (2)
5
2020-05-30
2014-03-20
No

getting "Current document is out of sync with the Interactions Pane and should be recompiled!"
on every single program I try to write.

I'm taking a beginners Java course right now, my teacher can't figure it out, and nor can the lead developer at my work... I've erased DrJava, redownloaded, ran as administrator...
I have recompiled the work. I've even started a new "Hello World" program, just to test it. Same results:
I compile: Check, no errors
I run: Output: "Current document is out of sync with the Interactions Pane and should be recompiled!"

Run: Current document is out of sync with the Interactions Pane and should be recompiled!

Discussion

  • Dave Pritchard

    Dave Pritchard - 2014-04-26

    I am also encountering this problem. (Running jar through java 8 and I've set up tools.jar correctly.) Note that in my "Console" it says

    "javacTask: target release 1.7 conflicts with default source release 1.8"

    I think this is referring to the compiler API (com.sun.source.util.JavacTask) but there doesn't seem to be any exposed option in the UI to change the target release version or add other arbitrary compiler options :(

    See also http://stackoverflow.com/questions/23007023/drjava-cannot-run-code-using-jdk8-0

    and

    https://sourceforge.net/p/drjava/bugs/946/

     

    Last edit: Dave Pritchard 2014-04-26
  • Kevin R. Bulgrien

    I know this is a very old ticket, but it popped up first on my search for a solution to this problem, and it has no answers, so I am going to post my findings anyway.

    IDK if this will (would have) help(ed) you or not, but I had the same problem with compilation not working. In my case, I am using a Linux system that has both OpenJDK and a manually installed Oracle JDK (extracted from a tarball obtained from java.com), along with some other JRE environments in various places. I "installed" the DrJava Version : drjava-20190813-220051 jar file and ran it from the command-line. I then clicked [ Manual Download ] when it asked about installing updates (drjava-beta-2019-220051).

    DrJava reported that my compiler was JDK 8.0_222. Note, I don't know where that compiler came from. As far as I know, I didn't have that version installed. My OpenJDK was:

    $ /bin/java -version
    openjdk version "1.8.0_252"
    OpenJDK Runtime Environment (build 1.8.0_252-b09)
    OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

    I typed in a simple "Hello World" program, and every attempt to compile produced:

    Compiler Output:
    "Compilation completed."

    This is a bug, because in fact compilation apparantly did not complete.

    Clicking "Run" produced:

    Interactions
    Welcome to DrJava. Working directory is /home/krb/Projects/Software/java
    Current document is out of sync with the Interactions Pane and should be recompiled!
    >

    Restarting DrJava, saving, clicking Reset, etc., would not clear the problem.

    In any event, at some point I noticed the Console tab was full of messages like:

    Console
    Compiler is using classPath = '[/home/krb/Projects/Software/java, /home/apps/drjava/drjava-beta-20190813-220051.jar]'; bootClassPath = 'null'
    Fatal Error: Unable to find package java.lang in classpath or bootclasspath

    At this point, I tried various things, but I focused on pointing DrJava to an Oracle Java JDK I had installed a few days ago. Everything I did was in Edit | Preferences ... | Resource Locations, though I beat around in there a while. All of the settings were "blank" before I started. Anyway, I eventually had some success after I'd set:

    Web Browser
    /usr/lib64/firefox/firefox
    Web Browser Command

    Tools.jar Location
    /home/raid/apps/oracle/jdk-1.8.0_251/jre/lib/tools.jar
    Display All Compiler Version [ ]
    Extra Classpath
    /home/raid/apps/oracle/jdk1.8.0_251/jre/lib
    /home/raid/apps/oracle/jdk1.8.0_251/lib

    At this point I decided to try to figure out the minimum required to get it working. After a lot of fudging around, I found it is sufficient just to set Tools.jar location, but with with one MAJOR caveat. You must BROWSE to the file using that dialog. YOU CANNOT JUST PASTE IN THE PATH! If you just paste in the path, it can look like it is set correctly, but the compiler will continue to not work. This was how I got the oracle jdk compiler to work.

    Next, I set about to see if I could get OpenJDK to work. I searched my entire system for another tools.jar that belonged to OpenJDK, and did not find one. Then I realized I did not have the DEVEL OpenJDK package installed (on Mageia Linux 7).

    java-1.8.0-openjdk-headless-1.8.0.252-1.b09.1.mga7
    java-1.8.0-openjdk-1.8.0.252-1.b09.1.mga7

    I installed:

    java-1.8.0-openjdk-devel-1.8.0.252-1.b09.1.mga7

    Now, even after resetting defaults, DrJava no longer says it is using JDK 8.0_222, but rather JDK 8.0-openjdk-1.8.0.252-1.b09.1.mga7.x86_64-OpenJDK, and everything works fine with NO customization to preferences!

    I don't know where the heck JDK 8.0_222 came from. There's nothing on my system with that version. I rather suppose it is some internal thing in DrJava. I think the takeaway is, either you have to:

    1) Point Tools.jar Location to tools.jar, making sure to browse to it and not just past in a path
    2) Make sure you actually have a tools.jar installed if your system might split up the OpenJDK installation.

    I know what I saw was with Linux and a .jar install of DrJava, and this might not be what you have, but perhaps the information will be helpful in offering you things to look at and try.

     

    Last edit: Kevin R. Bulgrien 2020-05-30

Log in to post a comment.