Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-6-openjdk-i386/jre"
Erm.. But it is pointing to a JDK, open-JDK here. Am I missing out on something here?
Ignore all solutions which suggest adding/setting a JAVA_HOME directory, they are wrong. If you have one set in your .profile etc, remove it.
Ubuntu (and a number of other distros, esp. debian based ones) use an 'alternatives' mechanism to provide a higher level of abstraction to handle things like multiple versions of the same software or multiple sotware packages which provide the same functionality, such as web browsers.
Ubuntu does not require a JAVA_HOME setting, provided you let the OS and it's packaging system manage your environment. If your manually installing things, your then on your own and need to work it out.
I suspect that originally, you only had the JRE installed, you then attempted to fix your problem by adding a JAVA_HOME setting and then later installed the required JDK. If this is the case, remove your JAVA_HOME setting and then use the update-alternatives command to make sure the correct java environment has been setup (see the man page for update-alternatives for details - its very easy).
The advice on using lein is IMO spot on and I would also recommend using the script rather than the packaged version. I would also recommend going witht he 2.0 preview version. It is quite stable and a better place to start than the older 1.x versions.
You could just install leiningen (which is packaged with Ubuntu). This will give you a nice project tool for working with Clojure. It bootstraps and pulls clojure in for you on a per package basis, which will also mean that you have more than one version.
Remove the jre part in the path. That should do the trick.
It would become
"/usr/lib/jvm/java-6-openjdk-i386"
Also as Brian suggested try
sudo apt-get install openjdk-7-jdk
Related
So, the full warning looks like
Build path specifies execution environment JavaSE-13. There are no JREs installed in the workspace that are strictly compatible with this environment.
I just installed JDK(version: 14.0.1 from here) and Eclipse(Version: 2020-03 (4.15.0) from here)
I've read post1 and post2 but i dont have any libraries in Java->Build Path -> User libraries. It's empty at all. In Installed Libraries i don't have any jdk{version}. I only have Name "JDK" and Location "D:\..."
Am i missing something vital? Because i have no idea how to fix it.
I am newbee, so if you have an answer or following question, please write a bit simpler. Thank you.
This should really be a comment, but I felt like spelling things out. The main thing to watch out for here is that with Java its version comes into play at least 4 times and there is nothing strictly stopping you from having 4 different versions configured on each occasion, which may or may not work. Add Eclipse and it becomes at least 5:
The java binary used to run Eclipse itself. (Configured via eclipse.ini)
This can affect how plugins behave. I remember a scenario where m2e would refuse to use a Java compliance level older than the version of the JRE running Eclipse. I can't make too confident specific calls from the top of my head here, but this is something to keep in mind.
Should be latest and greatest, though Java 8 appears to be the defensive option for obscure scenarios, such as projects depending on deprecated internal libraries. (tools.jar comes to mind)
The javac (java compiler) binary used to build your project. (Sits next to the java binary in a bin subdirectory of the JDK)
Should also be latest and greatest: every version of javac is capable of compiling source code written for previous versions as well as generating compatible byte code for older versions. This is what the following two points are about.
The Java version that javac is told to assert that your code is compatible with. (javac -source parameter)
The Java version that javac is told to make your build compatible with. (javac -target parameter; equal or greater than the value of -source)
The java binary used to run your build.
Should also be latest and greatest, though the minimum version required here is what was given to javac via -target, and incompatibility scenarios do exist.
The latest trend here is to ship every Java application with its own JRE to rule out problems arising from users having configured or installed Java in an incompatible manner. A user will then be required run a specially crafted native executable or a shortcut which will then invoke Java with the right arguments to start the application.
Now, you do not invoke javac or java even. In fact, the former is not even invoked by Eclipse. Eclipse actually comes with its own Java compiler, Eclipse Compiler for Java (ECJ). For what it's worth, we don't usually need to worry about that however. For Eclipse to know anything about available JREs, you need to match JDK locations on disk to Java versions "known" to Eclipse. This is done under Window -> Preferences -> Java -> Installed JREs -> Execution Environments.
After doing that, they should pop up in all the places where you can specify Java versions, which is mainly Project settings and possibly run configurations you have set up or Eclipse has set up for you. Project settings can then be set to up to infer the compliance level for building from the version of the JRE configured to run the build.
By the way, note that you probably want to use AdoptOpenJDK instead of the release from Oracle for reasons. You'll also want to just unpack any JREs which aren't the latest one in a nice folder somewhere on your hard drive instead of installing them. Installing them mostly means to make .jar files run with that version when launched from your OS's file browser. If you are on Linux, sdkman is currently the preferred way to do this.
My machine runs Windows 64 bits. I have multiple IDEs installed (eclipse, intelliJ, qt creator, visual studio) and I daily run some work applications that use java (vpn connector being the most important one).
Usually, when I get a java update notification I just accept and everything runs smoothly, but today I found that Eclipse is not starting because of exit error 13, which I read is caused by 32-bit/64-bit conflicts between Eclipse and Java. When I checked my java installation folders, I found out I have multiple folders, both for 32 bits and 64 bits:
I'm not even sure how those JRE folders ended up there, since I only download the JDK when I have to. Maybe they are the JRE installed with JDK but not sure.
Anyway, this is my 32-bit JAVA folder:
And this is my 64 bit-JAVA folder:
How can I get rid of all of those safely, download and install the latest JDK afresh and have everything running smoothly?
Thanks :)
The safest way remove Java installations on Windows is to run the respective uninstaller via the control panel. In addition to deleting the installations themselves, the uninstaller will (should) remove related entries from the Windows registry.
As other answers note, you would still need to ensure that the JAVA_HOME environment variable is updated to refer to the new Java installation, once you have installed it.
However, the problem with uninstalling copies of Java that you didn't explicitly install yourself is that you may end up breaking tools and applications that depend on those copies. If the tools use JAVA_HOME you should be fine. Otherwise, you might need to modify launcher scripts, etcetera.
If you are worried about this, you could rename the Java installations that you intend to remove, launch each of the apps, and see which of them breaks. (Then rename the Java installations back ...)
I had a problem like this before (with a lot of version and JDKs installed).
The best way is just to delete everything and download it again, i know that it isn't the best solution and it will take some time to download and install everything again but it worked for me before.
It does not matter how many jdk/jre folders you have. Just make sure environment variable JAVA_HOME and JRE_HOME points to the 64 bit jdk and jre folders correspondingly. You can remove other folders which are not pointed. The other applications may break after this change. You can fix them by pointing to this JAVA_HOME.
Refer this for setting JAVA_HOME env variable
I am putting together my first Java package for distribution to users, and am running into some difficulties. I have jar packages that I've built that users can't run; the error messages vary, but are all "version" something or another. I suspect I'm selecting the wrong build paths, and I'm not quite sure where to start troubleshooting because I don't clearly understand the differences between the Java executable (javaw.exe), the JDK and the JRE; I have some questions that I'd like answered which will help in that understanding. I'm used to the way that C# executables compile in VS; wrapping my head around how executable jar files come together is still a little mysterious to me.
Although I've done a few google searches, most of what I'm finding is how to build a jar file, but not how to manipulate/use/select the Java, JRE and JDK versions appropriately to ensure compatibility. I do understand that the JRE includes the virtual machine that allows Java bytecode to run anywhere, and that the JDK includes development tools...but as to figuring out which version I AM running, vs which version is used when building jar files and which version SHOULD be used...I am completely lost.
I'm using Eclipse Indigo under 64-bit Win7. My build path includes the following:
JRE System Library: C:\Program Files\java\jre7\*
External paths: C:\<MyDocuments>\java\lib\commons-io-2.4*
I also have, installed on my machine, the following paths which are NOT included in the build:
C:\Program Files (x86)\java\jre7\
C:\Program Files (x86)\java\jre1.5.0_22\
C:\Program Files (x86)\java\jdk1.7.0_21\
The users that will be running this executable file are only supported (by corporate IT) up to JRE5. I suspect that my building this pointing it jre7 is one of the things that's messing with me.
My first stupid question is whether there's a difference between "Java" and the "JRE" when it comes to version numbers. For instance, when I read about JavaSE7 or JavaEE7, are they talking about the JRE version for the standard or enterprise editions? Are the development kits and runtime environments just components to JavaSE/EE? Or are they separate and distinct products?
Then, my understanding is that I should build this jar using the lowest-common-denominator JRE expected from my users. In this particular case, because the corporate standard is JRE5, I should build this pointing to JRE5 instead of JRE7. Is that a correct assumption?
Does it matter if I build using the 64bit or 32bit version? Some older machines may still be 32bit running JRE5, so I need to make sure I'm backwards compatible.
The Program Files (x86) naming conventions confuse me. JRE7 installed as \jre7. However, JRE5 installed as \jre1.5.0_22, and I also have jdk1.7.0_21, which, based on the JRE name, I assume to be the Java7 Development Kit. Do I need to install the Java5 Development Kit to properly build this program? And am I properly interpreting the versions from the filenames? that 1.5 represents Java5 and 1.7 represents Java7?
Then, my last question I know there's an Eclipse option to copy the external libraries to the project. I assume that if I do this, this will be included with the jar so the users do NOT need to have the Apache Commons jars on their local machines in order for this to run properly. Does the manifest include any confirmations that these files were included? I've been unable to find any references...so I'm trying to verify if I'm even pulling the Commons libraries over and where to look to get that confirmation.
This is just speculation, but I think you may have to re-write the program with the java5 jdk, because some of the APIs/libraries used in java7's jdk may not be recognized by the java5 jre. (Just like it wouldn't be possible to play PS4 games on a PS2... without any serious modding)
If you write the program in Eclipse, you can just select what library you want to use as you create the Java project. At the "Create a Java Project" screen, you can select the "Use an execution environment JRE:" or "Use a project specific JRE" or "Use default JRE" option. (I have jdk6 and jdk7 installed on my computer so I'm able to select those two options; which is why you may have install the jdk5 in order to create a java 5 project.)
You are properly interpreting the filenames. jre1.5.0_22 is java 5 update 22.
There is a way to specify which JRE is used to run the jar file.
cmd prompt >
"C:\Program Files (x86)\java\jre1.5.0_22\bin\javaw.exe" -jar "filepath_filename.jar"
Drop the "w" from the javaw.exe, and you'll be able to see any console and/or stack trace output.
I'm on an Ubuntu Desktop that is set up with JDK 1.6.34 and everything works great. I'd like to install JDK 1.5.11 in such a way that my environmental variables, etc. don't get "blown out" by the installation of 1.5.11.
Is this even possible? Can the same machine have 2+ JDKs installed on it? If so, what are the necessary steps one needs to take to achieve this?
Yes, you can install as many JDK's on a machine as you want. As for "blowing out" environment variables, this is how you control which jdk you'll use (i.e. make sure the desired jdk's /bin directory is first in the path and that JAVA_HOME points to the JDK you want to be using).
I use Solr in my website, and now I am about to configure my VPS account.
I am at the stage where I need to install java in order to make Solr work.
Now, I only plan on running solr, and using it as it is (I have no java programming skills at all), so my Q is, do I need the entire JDK which includes JRE, or is JRE enough?
Thanks
BTW: My server OS is Linux (ubuntu 9.10).
Thanks
To only make it run JRE is sufficient.
However in development environment having a JDK is useful cause with it comes bunch of handy tools for profiling/monitoring the application.
In a production build while packing consider just the JRE.
This FAQ explains when a JDK is needed instead of just a JRE.
You need the JRE only. If you do use the admin screens you will however need the JDK as these are servlets.
Installing Solr just need JRE which is Java runtime environment, you require JDK if you intend to compile the java programs. Although, installing JDK gives you JRE as well but that is something which is not required by you.
Just install JRE and you will be good to go. For more details on difference between JDK and JRE, use following link:
Which one to download: JDK or JRE?