javac in terminal when java was installed with intellij - java

I have installed Java directly in IntelliJ on my new laptop (Oracle openjdk-17) and it doesn't recognize javac.
I've seen this post but there is no javac.exe in C:\Program Files (x86)\Common Files\Oracle\Java\javapath, only java.exe, javaw.exe and javaws.exe. There is a javac.exe in C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.3.2\jbr\bin but it doesn't work when I add it to the Path. Should I install an additional version of jdk.17 outside of IntelliJ to make it work?

Related

NativeScript installation

After installing NativeScript Im getting this error when trying to run the following command
ns doctor
C:\Program Files\Eclipse Adoptium\jdk-11.0.17.8-hotspot\bin;
C:\Program Files\Common Files\Oracle\Java\javapath;
C:\Program Files\Python310\Scripts\;
C:\Program Files\Python310\;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files (x86)\dotnet\;
C:\Program Files\Java\jdk-19\bin;
C:\Program Files\Git\cmd;C:\WINDOWS\system32>ns doctor
√ Getting environment information
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
There seem to be issues with your configuration.
√ Getting NativeScript components versions information...
√ Component nativescript has 8.4.0 version and is up to date.
√ Your ANDROID_HOME environment variable is set and points to correct directory.
√ Your adb from the Android SDK is correctly installed.
√ The Android SDK is installed.
√ A compatible Android SDK for compilation is found.
√ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
× Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable.
You will not be able to build your projects for Android.
To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as
described in https://docs.nativescript.org/environment-setup.html
× WARNING: The Java Development Kit (JDK) is not installed or is not configured properly.
You will not be able to work with the Android SDK and you might not be able
to perform some Android-related operations. To ensure that you can develop and
test your apps for Android, verify that you have installed the JDK as
described in http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html (for JDK 8).
Your environment is not configured properly and you will not be able to execute local builds.
Verify that your environment is configured according to the system requirements described at
https://docs.nativescript.org/environment-setup.html.
C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools;
C:\Program Files\Java\jdk-17.0.5\bin;
C:\ProgramData\chocolatey\bin;
C:\Program Files\nodejs\;
C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;
C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Program Files (x86)\BrowserStackLocal\;
C:\Program Files\JetBrains\IntelliJ IDEA 2022.1.3\bin;
C:\Program Files\MongoDB\Server\5.0\bin;
C:\Users\Admin\AppData\Local\Programs\mongosh\;
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.3\bin;
C:\Users\Admin\AppData\Roaming\npm
Also when I checked my Environment variables I can see this
```
C:\Program Files\Eclipse Adoptium\jdk-11.0.17.8-hotspot\bin;
C:\Program Files\Common Files\Oracle\Java\javapath;
C:\Program Files\Python310\Scripts\;
C:\Program Files\Python310\;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files (x86)\dotnet\;
**C:\Program Files\Java\jdk-19\bin;**
C:\Program Files\Git\cmd;
C:\Users\Admin\AppData\Local\Android\Sdk\platform-tools;
**C:\Program Files\Java\jdk-17.0.5\bin;**
C:\ProgramData\chocolatey\bin;
C:\Program Files\nodejs\;
C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;
C:\Users\Admin\AppData\Local\Programs\Microsoft VS Code\bin;
C:\Program Files (x86)\BrowserStackLocal\;
C:\Program Files\JetBrains\IntelliJ IDEA 2022.1.3\bin;
C:\Program Files\MongoDB\Server\5.0\bin;
C:\Users\Admin\AppData\Local\Programs\mongosh\;
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.3\bin;
C:\Users\Admin\AppData\Roaming\npm
Is the multiple jdks causing the issue, please guide me
Thanks in advance :)
I tried looking into the documentation marked as red in the command line error and also on google but nowhere it talks about multiple version issue

How to run jar files in Mac using JRE?

Mac OSX 10.11.14 (El Capatin) does not ship with Java, either the complete development kit (JDK) or the run-time environment (JRE). My need was to just run a .jar file and not for complete Java development. So I downloaded the JRE from here, which is a much smaller file compared to JDK (quite obviously).
This SO answer says that JRE is enough to run jar files.
After installation of JRE I couldn't locate the directory where installation happened or run java command to execute files on my mac. How do I run jar files now?
To run java application you can either use
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
or (as you found)
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
In any case, if you need to run java often, you should set JAVA_HOME in either your ~/.bash_profile or ~/.profile and amend the PATH to include the bin directory.
After JRE installation, the correct path is:
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
But now, how do I run the java command? It seems like the java file located in the directory above is not an executable.

How to change default eclipse IDE to new version IDE in Ubuntu?

I had installed eclipse some few months back in my Ubuntu machine.
so if I type command
eclipse
Eclipse IDE of version 3.8 loads.
But now I have downloaded 'eclipse mars' version, unzipped it and its present in folder location
/home/rahul/Installers/Eclipse-Mars/eclipse
I have also changed the content of file "eclipse.desktop" present in path
/usr/share/applications
to
eclipse.desktop
[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse Integrated Development Environment
Icon=/home/rahul/Installers/Eclipse-Mars/eclipse/icon.xpm
Exec=/home/rahul/Installers/Eclipse-Mars/eclipse/eclipse
Terminal=false
Categories=Development;IDE;Java;
But still if I type command "eclipse" it load the old Eclipse IDE i.e. 3.8 version.
Please tell me how do I fix it?
First of all try to get path of you existing eclipse by bellow command.
which eclipse
if it is /usr/bin/eclipse
mv /usr/bin/eclipse /usr/bin/eclipse.old
then
ln -s /home/rahul/Installers/Eclipse-Mars/eclipse/eclipse /usr/bin/eclipse
OR
EPATH=`which eclipse`; mv $EPATH "$EPATH.old"; ln -s /home/rahul/Installers/Eclipse-Mars/eclipse/eclipse $EPATH

javac not working on Win 8.1

I installed jdk 8_u25 on my Windows 8.1 ,but commands javac and javap aren't working. I went to environment variables and changed the value of Path to
C:\Program Files (x86)\AMD APP\bin\x86_64;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jre1.8.0_25\bin​
and still isn't working. My program files in on C: itself. Kindly help. Thank You.
When you install a JDK on Windows, as well as installing the JDK it also installs a separate "public" copy of the JRE for use by tools like web browser Applets and Java Web Start.
C:\Program Files\Java\jre1.8.0_25\bin​
looks like the bin directory of this public JRE installation rather than the JDK itself, and the public JRE does not include javac.
You need to add the JDK bin directory to your path instead of the public JRE one.

javac cannot be run, and furthermore does not seem installed

I have a problem involving setting up Java.
I have installed the JRE, added its path to PATH, and set JAVA_HOME and CLASSPATH. Now, java and javacpl work fine, but running javac generates a command-not-found error. Furthermore, javac.exe does not even seem to exist in the JRE's bin folder.
How do I run javac?
The JRE is merely the Java Runtime Environment, which includes only the infrastructure needed to run Java programs that are already compiled.
To compile Java source code using javac, you need the Java Development Kit (JDK).
On Oracle's Java download page, choose the package labelled "JDK".
In order to use javac in cmd , JDK must be installed in your system...
javac will not work if you are pointing "bin" folder inside JRE (C:\Program Files\Java**jre7**\bin)
Please check for javac.exe inside your bin folder(C:\Program Files\Java**jdk1.7.0_45**\bin)
javac.exe must be inside JDK(C:\Program Files\Java\jdk1.7.0_45\bin) not inside JRE (C:\Program Files (x86)\Java\jre7\bin) "JRE doesn't come with a compiler. It is simply a java runtime environment. What you need is the developmental kit." in order to use compiler javac
For javac path(Points to remember while setting system env variable)
path = C:\Program Files (x86)\Java\jre7\bin this is wrong
path = C:\Program Files\Java\jdk1.7.0_45\bin this is correct
Make sure "javac.exe" must be inside your "C:\Program Files\Java\jdk1.7.0_45\bin"
Dont confuse with JRE and JDK both are totally different
if you dont have JDK pls download from this link http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
reference thread for JDK VS JRE What is the difference between JDK and JRE?
Procedure:-
Install JDK
open cmd prompt
type "cd C:\Program Files\Java\jdk1.7.0_45\bin " press enter(path may change based on jdk version and 32bit and 64bit os version)
type "javac" press enter
its done
Now go and change your system environment variable
path = C:\Program Files\Java\jdk1.7.0_45\bin
this will set the path permanently
The JRE doesn't have javac - you need to download the JDK (Java Development Kit).
First, you need to install the jdk, then add the path of bin folder of jdk in the path vaiable.
you can refer to this link

Categories