DrJava: Cannot run code using JDK8.0 - java

Anyone having trouble using jdk 8.0 ??
Well, I don't know why I am facing some disturbances.
Not sure why , after compiling a javacode in 'drjava' while I try to run it , it says ...
" Current document is out of sync with the Interactions Pane and should be recompiled! "
I tried changing the compiler from JDK 8.0 to Eclipse Compiler 0.A48 it showed the same message .. after frequently recompiling and clicking the run button rather than using the shortcut key (F2) it ran !!!! then I toogled the compiler back to JDK 8.0 it ran also .(also the shortcut worked ) ..
But after few compilation of codes it started to show the same text ...
And the most irritating thing is now my drjava hangs while i try to change my compiler !!!
I think I have to go back to JDK 7u51 .. but I am really curious why this thing just happening

I'm getting errors when I try to run it with JDK 8 as well.
My temporary solution: download JRE (or JDK) 7 as a tar.gz, and DrJave as a jar. Unzip the JRE/JDK, and just run the jar with the v7 java
Works for now. I'm sure they'll get it sorted eventually, but meanwhile...

I am running DrJava on JDK 8 and I faced the same issue when I ran DrJava Windows App. I now run DrJava jar file instead of windows app.
This may also happen if you're trying to run your code which has been modified(accidently or otherwise) after your last compilation. Just compile it again (shift + F5) and run (keyboard - F2).
Unlike Eclipse and other sophisticated IDEs, DrJava requires you to compile all modified code before you run it.

Firstly, try to change the compiler from compiler output option given as shown. I hope it works. If it doesn't, download the jar file of dr java and do the necessary changes.

Related

Eclipse installer not showing any packages

When trying to install eclipse, when I run the installer I just get a blank box with no packages to select. Image Link
Any idea on how I could fix it, I have my java environment variable and java_home both set to the \bin location for both my java installations. The versions of java I currently am using are jdk 8 and I got jdk 16 to see if that might fix the issue but it didn't. As well, there weren't any errors or anything it just shows the empty box and shows that there's an update but I'm not sure what it's trying to update. Any idea how I could fix it?
Solution that worked for me:
Ok so after some fiddling around I had to search "eclipse" in the search all bar in windows. Then after some scrolling I was able to find the file "eclipse-isnt.exe" and after running that it showed the stuff to download and solved my problem. The "eclipse-isnt.exe" ended up being located in "C:/Users/(user)/AppData/Local/Temp/(random temp file)/eclipse-inst.exe".
Hope this helps out
Also running the file as administrator worked

Problem wrapping .java to .exe using Launch4J but problem is likely version compliance

I have a problem trying to wrap a java .jar as .exe and feel like I have checked out all there was on here which was remotely related. But I still couldn't get it to work. All the questions I found which seemed similar only concerned a part of my problem and also, the solution didn't work for me (such as this Convert .jar to .exe using launch4j or this The compiler compliance specified is 1.6 but a JRE 1.8 is used and many more).
The Problem
So, in my concrete case, I need to wrap a small program to a Windows .exe for an elderly person to use (I can't expect them to run a .jar file themselves). I'm trying to get everything to run on 1.0.8, so that's Java 8.
The errors I get are, on the one hand, that the resulting .exe doesn't work, throwing a class error (indicating that there's a problem with the compiler compliance) when trying to run it.
Later on, trying around, I also got a compiler compliance warning in Eclipse, so that's likely the problem.
Then I also get an error concerning module-info.java. Just deleting the contents of the file seems to help (in terms of Eclipse warnings) but the final result also doesn't work.
I saw that you need Java 9 to use module-info.java. What do I have to do with this? I couldn't find any helpful answers on here (or maybe I didn't understand them).
What I've tried
I have both the JDK and JRE installed (enviroment var set to JRE). I tried a clean and rebuild (like suggested in a question I can't find anymore) but it didn't do anything.
I am not so famililar with Java and usually use Linux, so Windows problems are not so familiar to me. I have found myself a Windows machine to compile my program from (because there seem to have been Java version problems when using Launch4J under Linux, trying to get an .exe.)
Edit: If one of you can help me solve my problem under Linux, that would be my favourite kind of solution. I currently use Linux Mint 20 but I also have Ubuntu installed on a machine I can access.
In the end, I think my Launch4J problem is actually a pre-existing problem of my .jar file stemming from the errors outlined above which I'll sum up again below:
I have been trying around for ages but I always get
The warning: The compiler compliance specified is 1.8 but a JRE 14 is used
The error: Syntax error on token "module", interface expected
I think that I should have fixed the compliance (both in Build Path and Compiler in the Properties) but it still doesn't work and it seems I've tried all there is. The environment variable is set and all. (There also isn't a javac.exe in my folder in case that makes a difference? Someone said to download it again but it doesn't help. Also, I've tried it on the customer's computer. They had a javac.exe and the whole thing still didn't work altough throwing different errors.)
Contents of module-info.java
Regarding the module, as the asker of this question ("Syntax error on token "module", interface expected") has nothing but
module NameOfMyThingy {
}
Maybe some of you can help - would appreciate it!
Thanks!
Rather than using launch4j, I recommend that you take a look at jpackage, which is available in JDK 14 and 15. See Packaging Tool User's Guide. Note that for Windows you will also need to download the WiX toolset.

How to work with NetBeans IDE 8.2 on Windows 7 64-bit with JDK

I've been having trouble using NetBeans IDE 8.2 with JDK on Windows 7 64-bit. NetBeans can compile code, but doesn't run it. I've downloaded all of the necessary files and programs and even consulted with a computer programming teacher, but I haven't been able to work around this issue. The URL displays an image that shows what I get back after attempting to run a code.
https://i.stack.imgur.com/RsEvx.png
I appreciate any help I can get.
Thanks,
--Sam
JavaApplication1.java is still set as your main class.
To change your main class, go into Project Properties -> Run and change "Main Class" to TestClass.java.
Essentially, the compiler is still running whatever main function is found in JavaApplication1.java.
#notyou Also mentioned how you can right click a file and run it directly, instead of changing the project settings. I used to use this but it slipped me! This is super useful.
I'm pretty sure this question has some answers for you.

With java 9 ea, Eclipse fails to install and show error "An error has occurred, see the log file null"

I know this problem occurs many time, but I have find a similar situation like I have.
Every time I click the Eclipse Installer, I will get a prompt:An error has occurred, see the log file null. I can't even install Eclipse.
I guess the problem is due to "JDK 9-ea", so I am planing to uninstall jdk 9-ea and use jdk8, but maybe you can help me to solve this problem directly, thanks !
First, you need to get the correct install most probably, here is the Oxygen 4.7 M6 link : http://download.eclipse.org/eclipse/downloads/drops4/S-4.7M6-201703082000/
Or the direct link to the .tar.gz
Then (after you untar the archive), go to :
Eclipse.app/Contents/Eclipse/eclipse.ini
and add one parameter after -vmargs. It should look like this:
-vmargs
--add-modules=java.se.ee
This will allow you to start the Eclipse under jdk-9.
In case you want to install the jdk-9 plugin (so that you could compile code under jdk-9): you need to install the Experimental Plugin for jdk-9. There were some problems with that (I filed a bug that was closed), see this thread. At the end there is the link for on how to get the plugin.
Then you need to follow the exact instructions here for it to actually work.
Simply adding this line to the eclipse.ini "--add-modules=java.se.ee" will resolve the whole issue
mine is macOs and Java 9 installed alone without any other version
Hope this helps

Java not compiling changes in my code

I have this problem with both Netbeans 8.0 and Eclipse. In Eclipse when I can write a Java program and it will compile and run fine. Then I can make a change to the source and when I run it again sometimes the old version of the code without the change in the one that is run. If I hit run a second time the new version is run.
In NetBeans I get a different error the second time I try to run updated code. "Could not find or load main class". This happens sometimes when I make changes to the source. I think this might have a similar cause to what is going on in Eclipse. In both cases the problems are intermittent and difficult to reliably reproduce.
I am using JDK 7 but before I was using JDK 8 and had the same problem.
I don't know about netbeans but in eclipse if you change code and you don't save before launching sometimes it executes the old code. So ctrl+s or hit the button save before launching every time. It seems that the run and save command are not issued by eclipse in the same order so it runs and saves at the same time but runs the old code.
i don't have the rights to comment right now so here it goes, i faced the similar problem when i was using net-beans 8.0. the main reason behind this problem is your classpath.("could not find or load main class").one way to ignore this problem is to set the classpath as the current directory(which can be done by using " set classpath=*;".). kindly revert if this doesn't solve your problem.
p.s: try it to compile with dos.
"C:\Program Files\Java\jdk1.8.0_05\bin" and you are good to compile.
and in eclipse, when the present src code has some errors.. it tend to compile and run the previous code.

Categories