Unable to locate a Java Runtime that supports javac - java

I am attempting to compile a "Hello World" program in Java 8 update 333. When I attempt to compile it, this happens:
The operation couldn’t be completed. Unable to locate a Java Runtime that supports javac.
Please visit http://www.java.com for information on installing Java.
java -version:
java version "1.8.0_333"
Java(TM) SE Runtime Environment (build 1.8.0_333-b02)
Java HotSpot(TM) 64-Bit Server VM (build 25.333-b02, mixed mode)

You probably installed a JRE (Java Runtime Environment) rather than a JDK (Java Development Kit). You need a JDK to be able to compile.
(Thanks go to RealSkeptic for the answer - see above.)

Related

Should versions of java & javac be same in the system?

Should java & javac version be same in the system?
as I am having java -version
java version "1.8.0_251" Java(TM) SE Runtime Environment (build
1.8.0_251-b08) Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
and javac -version
javac 1.8.0_181
Is there any issue if it's not the same version?
Should java & javac version be same in the system?
Not really, you can have as many java version as you want on one system, as long as you know which version you use when compiling or running application. If you have multiple java version in your system, be aware which version you put on your PATH environment variable to avoid a miss.
Your problem should be caused by multiple entry in your PATH environment variable that refering to java installation directory that has different version (note, java can be found in JDK and JRE installation, while javac can only be found in JDK installation).
Is there any issue if it's not the same version?
There should be no issue, as long as you don't use features that can only be found on the java version you use when compiling the program. In your case, the different is in build version, it's okay.

How to run evosuite with(out?) jdk

I get this error when i run EvoSuite
java.lang.RuntimeException: No Java compiler is available. Are you running with
the JDK?
A bit confusing, is it asking me to run with the JDK, or is it stating that i shouldn't?
When i run java -version it gives
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
You need to have JDK installed in your machine (and not just the JRE). This is because EvoSuite needs to compile and verify the tests it generates. If you have the JDK, but EvoSuite still does not find it, try to configure the JAVA_HOME system variable to point to it

Unable to build Floodlight Controller Package Eclipse

I am working on using Floodlight Controller for SDN. I used
ant eclipse
to setup the Eclipse files and then changed the Build Configuration as desired in the installation instructions. I am getting the following compilation error in the package net.floodlightcontroller.util.MatchUtils:
The method setMasked(MatchField<F>, Masked<F>) in the type Match.Builder is not applicable for the arguments (MatchField, Masked)
on lines 141 and 148.
Can somebody help me with the issue?
Operating System: Mac OS X 10.10
Java Version:
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
As suggested in the comments above, it works with Java SE 1.7. There is also a Github Issue.

Could not create the Java virtual machine OSX10.9

Can't seem to find an answer to this.
If I type java -version I get
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
I'm trying to run PMD to analyse an iOS project. When I run the command in Terminal however, I get:
Could not create the Java virtual machine.
Anyone have any idea what is causing this?
This could be due to installation issue. Check whether you have installed correct JRE for your platform(bit pattern etc.). If its fine try changing memory settings.
This link will help you to set memory settings in Java

How should I upgrade my Java compiler

When I run $ javac Simulator.java then I get the following warning:
warning: ./particle_simulator/Atom.class: major version 51 is newer than 50, the highest major version supported by this compiler.
I don't know why I suddenly get this warning as I haven't made substantial changes to my code. Nevertheless, how do I upgrade my Java compiler?
I'm running Mac OSX 10.7.5 and my Java version is below:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Download the JDK from Oracle: http://www.oracle.com/technetwork/java/javase/downloads/ . Make sure you get the OSX version. It has its own installer so installation should be pretty straight forward.

Categories

Resources