Menu

#359 Current document is out of sync with the Interactions Pane and should be recompiled!

v1.0 (example)
open
nobody
3
2020-05-30
2020-01-06
John Kumara
No

I just downloaded Dr Java but it saves the file Hello.class somewhere random. And therefore won't let me run hello world.

it says

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

1 Attachments

Related

Support Requests: #359

Discussion

  • John Kumara

    John Kumara - 2020-01-06

    I also get these errors in console:

    Compiler is using classPath = '[C:\Users\mikec\Desktop, C:\Users\mikec\Desktop\drjava-beta-20190813-220051 (1).jar]'; bootClassPath = 'null'
    Compiler is using classPath = '[C:\Users\mikec\Desktop, C:\Users\mikec\Desktop\drjava-beta-20190813-220051 (1).jar]'; bootClassPath = 'null'
    Fatal Error: Unable to find package java.lang in classpath or bootclasspath

     
    • Robert Cartwright

      Hi John,

      What version of Java are you using? DrJava only works with Java 8. I
      recommend Amazon Corretto 8. See
      https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/windows-7-install.html.

      In Java 9 and later versions, the layout and packaging of the Java
      distribution is incompatible with earlier versions of Java. Hence in Java
      9+, DrJava may fail by failing to find the file (rt.jar) that contains the
      java.lang classes in Java 8. You may also want to try using the DrJava
      release at https://www.cs.rice.edu/~javaplt/drjavarice/drjava.jar, which is
      the one I use. I doubt it affects the behavior of DrJava if you are
      running Java 9+ but it does include a few small bug fixes.

      Best,

      Corky Cartwright

      On Sun, Jan 5, 2020 at 9:52 PM John Kumara teamwolf11@users.sourceforge.net
      wrote:

      I also get these errors in console:

      Compiler is using classPath = '[C:\Users\mikec\Desktop,
      C:\Users\mikec\Desktop\drjava-beta-20190813-220051 (1).jar]
      ';
      bootClassPath = 'null'
      Compiler is using classPath = '[C:\Users\mikec\Desktop,
      C:\Users\mikec\Desktop\drjava-beta-20190813-220051 (1).jar]
      ';
      bootClassPath = 'null'
      Fatal Error: Unable to find package java.lang in classpath or bootclasspath


      Status: open
      Group: v1.0 (example)
      Labels: windows not compiling not finding a class class disappeared
      Created: Mon Jan 06, 2020 03:02 AM UTC by John Kumara
      Last Updated: Mon Jan 06, 2020 03:02 AM UTC
      Owner: nobody
      Attachments:

      I just downloaded Dr Java but it saves the file Hello.class somewhere
      random. And therefore won't let me run hello world.

      it says

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


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/drjava/support-requests/359/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Support Requests: #359

      • Bill

        Bill - 2020-01-31

        Corky,

        Coretto and AdoptOpenJDK have this issue on Mac 10.14 and 10.15 for sure. The Azul Zulu version 8 and Oracle's Java SE 8 do NOT suffer from this issue. I am able to reproduce this at will. (I have not been able to reproduce it on Windows 10 Education or Pro. All versions seem to work without condition.)

        I am still researching why this is the case, but the symptoms I see are related to writing the class file. DrJava cannot write the class file, but using javac on the command line is successfull.

        Another symptom is if you double-click the JAR, you cannot see the contents of the Desktop folder (for exmaple) when using Open. However running "java -jar drjava.jar" allows you to see the contents of the Desktop and select the Java file without issue, but still cannot write the class file.

        When I know more, I will post it here.

        Bill

         
        • Robert Cartwright

          I had problems running DrJava on Windows 10 until I removed all of my Java
          installations except Amazon Corretto 8. Java apparently uses some
          environment variables (like JAVA_HOME and LD_LIBRARY_PATH) which are not
          treated consistently across JVMs or platforms. See
          https://stackoverflow.com/questions/27945268/difference-between-using-java-library-path-and-ld-library-path.
          DrJava appears to work normally (except for code coverage) on Windows 10
          when Amazon Corretto 8 is installed after removing all other JVMs. I have
          not tried using Mac OS X, but it apparently treats LD_LIBRARY_PATH
          differently than Linux which the development platform for DrJava. DrJava
          works normally (except for code coverage which I am working on repairing)
          on Unbuntu Linux 18.04 with the defaut OpenJDK 8 installation and on
          Windows 10 with Amazon Corretto 8.

          On Fri, Jan 31, 2020 at 1:26 PM Bill jojowil@users.sourceforge.net wrote:

          Corky,

          Coretto and AdoptOpenJDK have this issue on Mac 10.14 and 10.15 for sure.
          The Azul Zulu version 8 and Oracle's Java SE 8 do NOT suffer from this
          issue. I am able to reproduce this at will. (I have not been able to
          reproduce it on Windows 10 Education or Pro. All versions seem to work
          without condition.)

          I am still researching why this is the case, but the symptoms I see are
          related to writing the class file. DrJava cannot write the class file, but
          using javac on the command line is successfull.

          Another symptom is if you double-click the JAR, you cannot see the
          contents of the Desktop folder (for exmaple) when using Open. However
          running "java -jar drjava.jar" allows you to see the contents of the
          Desktop and select the Java file without issue, but still cannot write the
          class file.

          When I know more, I will post it here.

          Bill

          Status: open
          Group: v1.0 (example)
          Labels: windows not compiling not finding a class class disappeared
          Created: Mon Jan 06, 2020 03:02 AM UTC by John Kumara
          Last Updated: Mon Jan 06, 2020 03:52 AM UTC
          Owner: nobody
          Attachments:

          I just downloaded Dr Java but it saves the file Hello.class somewhere
          random. And therefore won't let me run hello world.

          it says

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


          Sent from sourceforge.net because you indicated interest in
          https://sourceforge.net/p/drjava/support-requests/359/

          To unsubscribe from further messages, please visit
          https://sourceforge.net/auth/subscriptions/

           

          Related

          Support Requests: #359

          • Sal Iacono

            Sal Iacono - 2020-02-04

            I am experiencing the same issue that Bill describes on OSX. I would just add to the description of that problem that it is as if DrJava is not seeing the installation of Corretto8 on the Mac.

            When launching DrJava, the compiler output pane shows:

            Compiler ready: JDK 8.0_222 from /Users/<username>/<filelocation>/drjava-beta-20190813-220051.jar

            I tried adding the path to the location of tools.jar file to the preferences dialog and verified that it is writing that path to the .drjava config file but it has no effect at all.

            I checked the compiler pulldown list and there is no other compiler listed

            FYI: when I checking jdk installations in the terminal using 'java -version' the only one listed was Corretto

             

            Last edit: Sal Iacono 2020-02-04
  • Kevin R. Bulgrien

    IDK if this will help 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.

     
  • Robert Cartwright

    My apologies for not responding sooner. I somehow missed seeing this support thread until Kevin's message showed up in my email inbox a few minutes ago.

    On my Linux system, I have the Linux OpenJDK 8 and the Amaretto 8 JDK installed. DrJava searches for all of the compilers it can find in common locations for JDK installations on various platforms. The compilation tab in the interactions pane (below the main editing pane) shows the available compilers in a pulldown menu in a subpanel on the right hand side of the display. In my case when I run the latest beta release, three compilers are shown: (i) JDK 8.0 amazon-corretto; (ii) JDK 8.0-openjdk-amd64-openJDK; and (iii) JDK 8.0_222. The first compiler is from the Amaretto installation; the second is from the Linux openjdk-8-jdk package; and the third is the openJDK 8 compiler (embedded in tools.jar) bundled with DrJava. The first two compilers appear to be identical both are taken from java.version 1.8.0_252. The third compiler is older (from java.version 1.8.0_222, but I have not tripped over any differences between this compiler an the 1.8.0_252 version.

    I always use the defaults for the Resource Locations and Compiler Options. In fact, the only preferences that I sometimes change are Display Options and the arguments passed to the JVM that can be set in Miscellaneoius:JVMs (to change heap sizes and stack sizes when performing large computations). Beginners should leave the Preferences set to the default values.

    A newer version of DrJava (not yet released) is available at www.cs.rice.edu/javaplt/drjavarice. The most recent build at that site runs code coverage correctly on my solutions to some large Java programming exercises in courses that I teach. It also bundles the tools.jar file from java.version 1.8.0_242 instead of 1.8.0_222. (FYI, nearly all Rice undergraduates now use IntelliJ as their IDE instead of DrJava since we no longer teach Java as an introductory programming language. I briefly tried using IntelliJ but found it much more difficult to use--albeit more powerful-- than DrJava.) I quit using Macs over a decade ago when Apple abandoned support for 32 bit Java 6 and I had five or six dual core 32 bit Macs (mostly MacBooks) in my development lab, which instantly became obsolete. I routinely run DrJava on both Ubuntu Linux 18.04 and Windows 10 (which I dislike but am forced to use in class for PowerPoint compatiblity), so I generally make sure that DrJava works on Windows 10 and Ubuntu Linux. It sounds like Mac OS X has enough differences from Ubuntu Linux to cause some problems. Perhaps the Azul Systems version of OpenJDK-8 is the better choice for Macs.

    I definitely suggest downloading the latest build (a jar file) at www.cs.rice.edu/javaplt/drjavarice and setting all Preferences to the default values. I have not used the "Run" command in years since I detest console I/O except for debugging output, but I just tried running a HelloWorld program on my Linux machine (using the current Ubuntu Linux OpenJDK-8 java) with all three available compilers using the "Compile" and "Run" commands (buttons) and it worked as expected. I would hope that DrJava runs properly on Macs using either the Azul Systems or Amazon Corretto OpenJDK 8 but I have no personal experience on which to base this hope.

    After I post this message I will try using the Amazon Corretto OpenJDK * instead of the Ubuntu Linux OpenJDK 8 and report any problems that I encounter.

    Please let me know what happens.

     
  • Robert Cartwright

    I just tried using the Amazon Corretto OpenJDK 8 and initially tripped over the fact that there is no java command in /usr/lib/jvm/java-1.8.0-amazon-corretto/bin. For some reason (why?), the java command is only available in /usr/lib/jvm/java-1.8.0-amazon-corretto/jre/bin. At any rate, once I used the "correct"path to the java command, everything worked.

     
  • Robert Cartwright

    In "flat-file" mode, DrJava puts each class file in exactly the same location as the command line default: the same folder as the corresponding source file. If you set up a project (which uses exactly the same source file layout as command line Java), you can specify a "Build Directory" which will place the class files in a file tree with exactly the same structure as the source file tree. The "Compile Project" command compiles all of the source files that are listed in the navigation pane to the left of the main editing window. If the project already exists in command line format, you simply (i) create a DrJava project and specify the root of the command line project as the "Source Directory"; (ii) name a file (which I typically call "classes" and place it next to the source root) as the "Build Directory"; and (iii) open (with the "recursively" box checked) the source root folder. (DrJava uses the terms "directory" and "folder" synonymously.) You MUST explicitly save the project after opening the source root folder; otherwise the project file will not open the files (in the navigation pane) when you open the project. A DrJava project file keeps track of which source files actually belong to the project, enabling the source file tree to contain source files that are not currently part of the project.

    When you compile a project, DrJava will create whatever part of the class file tree (including the root) is required to store the class files. So you do not need to manually create any of the folders in the class file tree.

     

Log in to post a comment.