I recently downloaded and unziped openJdk 14
I then went to Eclipse > Java > Installed JREs and set the new jdk to be used
However after doing this I am no longer able to run my server (tomcat webapp)
I get an error from the jdk
as well as a generic error in eclipse saying it failed to start
When googling around it said to check my paths, but as far as i can tell they are correct:
(user variable)
%JAVA_HOME% = C:\JavaProgramFiles\jdk-14.0.2
(system & user variable)
Path %JAVA_HOME%\bin
Update 1 (FYI removed some path stuff as it doesnt seem relevant anymore):
thanks #KunLun
when cd'ing into the bin directory, javac -version worked. I reviewed environment variables again and this time added %JAVA_HOME%/bin to my User's Path variable (previously it was only in system path). So now javac -version works from any directory. However Eclipse still has same error when i start my server, though i do get this new msg in the console?
-Djava.endorsed.dirs=C:\JavaProgramFiles\tomcat\apache-tomcat-9.0.21\endorsed
is not supported. Endorsed standards and standalone APIs in modular
form will be supported via the concept of upgradeable modules.
The error message you quoted shows the cause of the problem. When the server instance was defined, the JVM launch arguments set for it included a reference to endorsed directories, an argument valid through Java 8, but not for Java 9 and newer. When you open the editor for your server instance from inside the Servers View, in the General Information section, Click on the Runtime Environment link and change the JRE explicitly to a Java 8 version. The server should then start up again.
Related
I am new to Java. I am taking a University beginners Java course. I'm running my first hello world code and am getting an error message. I have installed the latest Dr. Java stable version and have installed Java SE 12 JDK.
I have uninstalled and reinstalled Dr. Java several times and still getting error message. I have also recompiled it to and still the error message is there.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
I expected the code output to say, "Hello World" under the interactions pane but it isn't and instead there is an error message that says, "Current document is out of sync with the Interactions Pane and should be recompiled!".
Also, under the console pane I receive the following message:
Compiler is using classPath = '[C:\Users\Admin,
C:\Users\Admin\Downloads\drjava-beta-20190813-220051.jar]';
bootClassPath = 'null' Fatal Error: Unable to find package java.lang
in classpath or bootclasspath
Realizing that the OP solved his problem by version of JDK, I ran across this question after experiencing the same symptoms he describes. With that, it seems possibly appropriate to post a solution for the symptoms even though the problem ended up not being quite "identical" to the OP's situation:
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 apparently 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
NOTE: Your PATHs will NOT be the same as mine! You need to use the
actual paths on your system. In my case I searched for "rt.jar" and
"tools.jar" that were obviously in folders related to an installed
JDK.
At this point I decided to try to figure out the minimum required to get it working. After a lot of fiddling around, I found it is sufficient just to set Preferences | Resource Locations | 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 takeaways are:
If DrJava says its using JDK 8.0_222, it probably is not going to work!
Make sure you actually have a tools.jar installed if your system might split up the OpenJDK installation.
Point Tools.jar Location to an existing tools.jar file where the JDK you are using is installed, and making sure to browse to it (not just paste in a path).
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.
As the answers above state, DrJava is not compatible with newer versions of Java than Java 8. Most of the DrJava codebase was written long before the open source version of Java was viable. The Sun Microsystems and Oracle javac compilers are proprietary and cannot be distributed with open source apps like DrJava. So DrJava searches for tools.jar (the library file containing the compiler in Java JDK distributions prior to Java 9) in common locations on Windows, Mac OS X, and Linux to find a compiler (more accurately, what were common locations in 2007). If you are running DrJava from a Java 8 JDK, it almost always finds it (although it appears to be failing for some installations Amazon Corretto 8). The most recent available build (March 3, 2020) of DrJava at www.cs.rice.edu/~javaplt/drjavarice may do a better job. I know it includes a later version the open source Java 8 compiler (JDK 8.0_242) and that it also finds the compiler (JDK 8.0_265) in the Corretto 8 distribution that I am using on Windows 10. The mysterious version of the open source JDK compiler reported above is being retrieved from the drjava.jar file itself. Now that the open source JDK includes a reliable compiler (which I suspect is nearly identical to the Oracle Java 8 SE compiler), the drjava.jar file includes a recent build of the open source Java 8 compiler.
Your solution helped me troubleshoot a problem with DrJava not recognizing the Amazon Carretta JDK on a Mac.
The fix is to open DrJava and go to Edit -> Preferences -> Resource Locations. From the Tools.jar Location box you must use the three dots at the end of that box to navigate to the tools.jar file on your Mac, which is probably in /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/lib/tools.jar.
Java 11 had recently arrived and, as everybody knows, this version has no installation file.
To install Java without installer I, of course, had set my system settings PATH and JAVA HOME to the address of the folder where my Java 11 was unzipped (advised by accepted reponses to similar questions).
The only thing is that all those advices about system settings make no effect whatsoever on my machine:
Checking with a command line outputs my old Java 9 version
With Java 9 removed from the folder, command line does not recognise any Java at all.
So, is there actually any way to install this version?
Thanks for future answers and for not marking my question as a duplicate (for the reason explained above)
The problem resided in the format of the path line:
My path included multiple entries, I was putting Java at the end of the line and the change was not working
But when I placed it right at the start of the path line, Java 11 got accepted and started to function alright on my Windows.
For other users facing a similar issue:
The root of the problem was that, as Klitos Kyriacou rightly pointed out, my path included other entries that had a word 'java' in their names. When placed before Java 11 in the classpath, those entries were invalidating my adding of the java version.
Looks like Oracle uninstaller does not clean up everything.
Even after uninstalling all old jdk/jre and installing OracleJDK 11, my system still has "C:\ProgramData\Oracle\Java\javapath" folder and "C:\ProgramData\Oracle\Java\javapath" entry in PATH.
Because of that when I run "java -version" I get:
C:\>java -version
Error: opening registry key 'Software\JavaSoft\JRE'
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
I´m starting to learn Java EE.
I installed wildfly in Windows.
I already have JDK 8 installed and I have it set up in my Environment Variables as
JAVA_HOME C:\Program Files\Java\jdk1.8.0_05
As you can see JDK is installed in the default folder in program files.
Wildfly is installed in a specific folder(is the lastest version since I just downloaded. EAP 7.0.0):
C:\develop\wildfly\
I set up the Environment Variables of wildfly too. as
JBOSS_HOME C:\Develop\wildFly
I started the server in net beans and when I tried to enter in the Administration Console the server display a message that I needed to add a user and I should run add-user.bat
The problem is when I try to run this .bat file.
I get the error "The system cannot find the path specified"
Even though I found some questions concerning this issue I couldn´t find a correct answer since I don´t have any of the problems that the answers state that could make this error. (no JDK installed, not set up environment variables)
please tell me if you need further information.
For Windows OS open {WILDFLY_HOME}/bin/standalone.conf.bat
And Find JAVA_HOME
The Default value may like rem set "JAVA_HOME=C:\opt\jdk1.6.0_23"
Change it to
set "JAVA_HOME=PATH_TO_JAVA"
e.g. set "JAVA_HOME=D:\Java\Java8\"
For Linux do same in standalone.sh
I installed eclipse Neon.
But when i clicked on it to open, It is not opening.
I even have set the Path in Environment Variables.
Check that the JAVA_HOME environment variable is defined and %JAVA_HOME%\bin is in your system path. You can verify that by opening a command prompt, navigate to your eclipse folder and typing
java -version
If that commands returns the java version then everything should be fine.
Also, check if eclipse is using the right version of JDK/JRE. A 32 bit installation of eclipse would require a 32 bit JDK/JRE and vice versa for 64 bit editions. If that does not solve the issue check for messages in your Eclipse logs in your workspace:
${workspace}/.metadata/.log
You can also redirect any error messages to your console using the -consoleLog startup option.
Also check if there is any error initializing the java heap. If that's the case there should be at least one hs_err_pidXXXXX.log file generated in your eclipse folder.
I've been working on Aptana Studio and some JRE required software for a bit of time now , but since yesterday something quite odd happened, as suddenly the software that requires it threw me an error No Java virtual machine was found . Last thing I did before that was restoring my system files permissions thought safe mode as I had some trouble with that , could this have anything to do with it ?
I've tried installing JRE once again , no results. However when I run
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
I do get the following
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Aptana gives me the following error
No Java virtual machine
was found after searching the following locations:
/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java
java in your current PATH
And other software such as Spine won't simply start.
My .bash_profile is the following :
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
PATH="/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:${PAT$
export PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
The output of echo $PATHis the following
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
The output of echo $JAVA_HOME is the following
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
And Java invocations on the terminal work.
Guidance will be highly appreciated.
After trying Peter's suggestion the problem persisted but now in another context : "/System/Library/Frameworks/JavaVM.framework" does not contain the JNI_CreateJavaVM symbol"
After struggling for many hours, and reading about people with the same issue opting to re-install the entire OS , decided to examine the issue from another perspective, the thing I first mentioned here that I believe went unnoticed was that I restored my permissions before this happening, so what I did was the following.
After reading a bunch of articles about Apple no longer providing Java support themselves but Oracle providing it, reasoned through it and realized that perhaps paths (Often called directories) from Apple's final Java release may have not been strictly the same as the new Oracle releases, so decided to wipe out all recent Oracle Java Runtime Environment that I found on /Library/Java/JavaVirtualMachines and delete the Java Applet Plugin from /Applications (Just search for it on your /Applications path) .
Installed Apple's last stable release from the following link.
Located where Apple located their Java releases : /System/Library/Frameworks/
My particular interest was the Java Runtime Environment , so I explored the JavaVM directory on /System/Library/Frameworks/
Found out that all Apple's JRE previous releases reside on a directory called Versions that is within /System/Library/Frameworks/JavaVM.framework directory, here's where I noticed something rare, for some reason at the moment I restored file permissions from my Disk Utility Application , this directory was made inaccessible (By not giving the root user permissions to access anything in itself).
Went to my terminal console and inside the JavaVM.framework directory modified the permissions to that directory to be accessible for all users by running the following command chmod -R 777 Versions.
After executing these actions I went straight to my JRE-Required software and attempted to open it , success!
Things to learn from the issue.
Oracle's Java JDK/JRE are located in different paths from Apple's. (If you are struggling with some other issue, verify your Java version to determine your Java installation directory)
Apple's disk utility application might define different permissions than expected for some files. (After restoring permissions verify that everything's working fine, if not this may be the cause of your problems.)
Looks like AptanaStudio (Eclisebased right?) assumes that you have a JRE inside the Aptana directory (/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java)
I assume that there is nothing there. Simplest way would be to symlink your existing JRE installation to that directory:
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre /Applications/Aptana\ Studio\ 3/AptanaStudio3.app/Contents/MacOS/jre
Or you could start Aptana from the terminal and specify the path to java with -vm:
./aptana -vm "/path/to/java/bin/directory"
Environment variables that must be available to GUI applications are a bit tricky in OsX (at least in my experience).
It is possible to set global PATH (and other variables) in /etc/launchd.conf, see for example here and /etc/paths.d see here.
Simple Solution
For Windows:
1.download the JAVA runtime environment x86(32bit) version else you will get an error with dll file from here http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Extract the folder out of the .tar file you downloaded.
Rename the JRE folder to "jre"
Then paste it in to this directory
C:\Users\"User Name"\AppData\Roaming\Appcelerator\Aptana Studio
This worked for me
I uninstalled all my Java JREs and JDK for Windows 10. Then I downloaded Aptana again and let it install Java for me. I think JAVA 8 was my problem, but this worked and I can still install the other versions again.