Java runtime error on Flutter VScode for Mac - java

I used to work on Flutter months ago daily and when I came back I had this error showed while trying to debug:
Unable to locate a Java Runtime
After trying several solutions from Stackoverflow and redownload java from the internet I am still stick with this problem:
Kotlin could not find the required JDK tools in the Java installation '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
I know there is a solution on Android Studio but can't get to it on VsCode. Where is the package I have to create the JDK so I can debug normally ?
Thanks in advance.

Related

Problems with Java on Visual Studio Code

I only have a Raspberry Pi to practice, and Visual Studio Code runs smoothly on it for many languages I've tried, but I can't seem to run Java on it. I installed the Extension Pack for Java, but when I create a Java Project and try to run it, the Debugger keeps loading and doesn't start at all. I tried uninstalling/reinstalling the Extension Pack and the Debugger, but without success. I know the solution might be obvious, but I tried googling it and found nothing.
Found out that the latest version of the extension "Language Support for Java by RedHat" wasn't working properly on my VSCode. I installed version 1.0.0 and it loaded everything and now I can run Java smoothly.

Libgdx could not determine java version 11.0.1

I tried everything I installed every possible Java file a million times I installed the newest gradle version but it continues to show this error. I'm on Mac. Please help thanks
IF you do not want to develop for Android Java 11 works fine libgdx.
You have to change some things before everything builds and runs.
Here's what I did to get my project working.
My context Mac OSX 10.14 and openJDK 11.0.2, new project, Desktop launcher and a bunch of Extensions (not important).
The error you get about not being able to find java 11.0.x comes from gradle. Java 11 is only supported since gradle 5. In order to use gradle 5 instead of 4.6 the generated project is configured with, go to <project-dir>/gradle/wrapper/gradle-wrapper.properties and change distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip into distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip.
That resolves the java 11 error just to confront you with a new error Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
To get rid of that, open <project-dir>/desktop/build.gradle and change line 27 (might be different for you)
from files(sourceSets.main.output.classesDir) into
from files(sourceSets.main.output.classesDirs)
thats classesDir into classesDirs
This should resolve all build errors and you're good to go.
I am strongly recommend to use Java version not greater than 8. It is many incompatibility issues I faced just on 9 version of JDK in Android Dev environment.
Uninstall all java you have, use this article, because it is not as such easy without knowledge: https://www.java.com/en/download/help/mac_uninstall_java.xml
After download the 8th version from here: https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I did same some time ago and all problems left

Eclipse Neon (MAC OS), Static Web Project doesn't work (could not find JRE executable)

I am new to programming and webdesign. I started with Eclipse some months ago to learn Java. Everything works fine. When I tried today to run a Static Web Project on a HTTP Server Preview (like in that Tutorial https://www.youtube.com/watch?v=URCyWNflkpQ), Eclipse had some issue with an older Java version.
I found Java JDK (1.6) that I deleted afterwards.
I reinstalled the latest Java JDK (1.8.0_60) and made sure that only this version is in the /library/java/... . I got me a new Eclipse version as well (Eclipse Neon). Running Javaprojects like before still works.
As soon as I try to run my HTMLfile, Eclipse shows me the errormessage:
'Starting HTTP Preview at localhost' has encountered a problem.
Could not find JRE executable
When I try it with J2EE Server Preview it works though. Can I simply use this Server Preview instead? This errormessage took me hours of hopelessly searching the internet for answers. Maybe for nothing...^^
Here somebody had the same issue, but on windows. I tried the solutions, but they didn't work either:
https://www.eclipse.org/forums/index.php/m/1703151/?srch=Could+not+find+JRE+executable+http#msg_1703151
Thanks for the help!
It's a Mac-specific bug. It'll be fixed in Oxygen.1.
http://bugs.eclipse.org/518546

Updating Java and JRE are causing many errors in Eclipse

I'm using Eclipse to program Android applications, and when I opened the program yesterday, it popped up an error saying I need to install JRE - I've downloaded the JRE and installed it - when during the installation I got a message saying that the JAVA version I have on the computer (Version 7) is too old for the JRE (Version 8), and that I need to update the JAVA also.
I did so, and then opened up the Eclipse again - And all of the projects,that before worked great, are now full with errors.
I tried installing all of the SDK updates - didn't work, also tried uninstalling Eclipse and re-install it - also didn't work.
The errors I get are: "XXX cannot be resolved to a type" - in amost every single line in the project.
How do I fix it??
Thank you!!
android development tool(adt) are install.. and all update SDK and then import an old program.. Ithink then work.
I would suggest to check that your java build path is functioning properly. This kind of error for me usually means that eclipse cannot find the JRE installation.
Form eclipse you can go to Project->Properties and check for any errors there. Any inconsistency there would cause all your projects to fail.
First of all, you need the JDK installation, not JRE. Second, Android currently supports up to Java v7, which means you'll need to get JDK v7 from here. Make sure you download the correct 32-bit or 64-bit JDK version for your operating system.
Also, ensure your Android SDK and Android Development Tools (ADT) are on the same released version. Different versions of Android SDK and ADT can lead to many unforseen problems.

Unable to run Java Applications in Eclipse [duplicate]

I'm trying to get started with Eclipse/Java/Scala on a MacBook. The installed JDK was 1.5. The SDT plugin for Scala requires 1.6 which was included in an OS update, but I also manually installed a package from Apple to update 1.6.
The problem is that I cannot run anything from Eclipse. I always get the following error:
An internal error occurred during: "Launching TestFooBasicTest".
Could not initialize class com.ibm.icu.impl.JavaTimeZone
I also tried to use the old 1.5 version, but to no avail.
What is going wrong here?
I had the same problem trying to run a scala program with Ubuntu 10.4 and stock eclipse (Galileo 3.5.2) and java (java-6-openJdk ) - and the scala pluging downloaded from scala site, of course. I fixed it by manually changing /usr/lib/eclipse/plugins/com.ibm.icu_4.0.1.v20100125.jar as suggested in this thread (btw I discovered that Emacs can change a jar file in place: nice):
http://www.eclipse.org/forums/index.php?t=msg&goto=488654
It's caused by ubuntu openjdk package with broken symbol links for TimeZone configuration. The best solution from forum thread is,
Reinstalling tzdata-java was the fix for me:
sudo apt-get --reinstall install tzdata-java
The problem is:
An internal error occurred during: "Launching TestFooBasicTest". Could not initialize class com.ibm.icu.impl.JavaTimeZone
A quick google search reveals that this class belongs to the IBM Globalization package ICU. http://www-01.ibm.com/software/globalization/icu/index.jsp
A guess would be that this is a package used internally by Scala that you have not installed properly, causing Scala startup to fail.
Make sure that you set java 1.6 in the run configuration (Run/Run configurations).
Did you upgrade to Snow Leopard? Are you using the Eclipse SWT/Carbon or the Eclipse SWT/Cocoa? I was seeing some strangeness with Eclipse after I upgraded to SL. Switching to the Eclipse SWT/Cocoa from Eclipse SWT/Carbon helped. Also restoring my 1.5 VM, which the SL install removes in a sneaky way(by deleting and leaving the symbolic link pointing to 1.6), helped me fix several issues with Java code that had natives(i.e. usb-serial port code).
Check what are the JVMs that Eclipse is aware of and where they are located (Preferences -> Java -> Installed JRE), and also check the run/debug configuration of your programs. By default, Eclipse knows about the JRE that was used to launch itself, and other JREs that you add manually. However, if you upgrade some components and the JREs changed, Eclipse can get "confused" about them.
I had this same issue with Eclipse on Windows. I tried a number of different things including a new hello world program in a new workspace. I finally got this to work by pointing Eclipse to a different JRE to execute with. I know that Apple provides the JRE for Mac, but it does seem like this issue is related to Eclipse having trouble with the JRE used to run Eclipse itself. See here for configuring which VM Eclipse executes with.

Categories