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

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

Related

Installing Netbeans 8.2 on MacOS Big Sur no JDK found

I have recently upgraded into MacOS Big Sur and when tried to open NetBeans 8.2 it gave an error
The JDK is missing and is required to run some NetBeans modules. Please use the --JDK home command-line option to specify a JDK installation
I tried setting JAVA_HOME to the JDK path but it didn't work. So, I uninstalled Netbeans and JDK and re-downloaded Netbeans 8.2 and JDK 8.
Now when trying to set up the Netbeans, it shows :
NetBeans IDE cannot be installed. Java (JRE) found on your computer but JDK 8 or newer is required. Please download and install the latest update of JDK 8 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.
Java -version
java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)
Javac -version
javac 1.8.0_271
My current $JAVA_HOME is set to/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
I also tried installing NetBeans 11 and 12 with JDK 14 and 15 but it gives the same error
EDIT:
Following is the only solution that worked for me.
/Applications/NetBeans/Apache\ NetBeans\ 12.1.app/Contents/Resources/NetBeans/netbeans/bin/netbeans --jdkhome /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
Paste the above command on terminal. It opens the NetBeans. To use the NetBeans without typing the command again save the above command on a code editor and save as NetBeans.command file.
Then open the file. Click okay on the prompted message. Type following command on the terminal.
sudo passwd root
Type your login password.
Just press Enter (you don't have to type a new password)
Type su root and your login password again.
Type chmod +x <path of the file you saved with .command>. Quit the terminal and open the saved file. It should work now.
I had the same problem.
I have not needed to restart the computer.
I have simply changed the line:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home"
in the file netbeans.conf, from the directory:
/Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
and this has worked for me
I got the same issue when I could install Netbeans. And this works for me:
run this command line in terminal:
brew install netbeans
The problem seems to be the fact that /usr/libexec/java_home seems to be broken in BigSur (see here: https://developer.apple.com/forums/thread/666681).
The Netbeans installer checks if the JDK is installed by using /usr/libexec/java_home, gets the wrong answer and quits with an error.
One way to fix that behaviour is to patch the installer. It can be done as follows:
assuming there is no directory called "a" in tmp:
Open the dmg, but do not run the installer
In a shell give the following command:
pkgutil --expand /Volumes/NetBeans\ 8.2\ RC/NetBeans\ 8.2\ RC.pkg /tmp/a
(if your Netbeans installer has a different name, change the command to reflect the actual name of your installer)
This opens the package, and copies it s content in /tmp/a.
Edit the installation script. Using a text editor, open the file /tmp/a/Distribution.
on line 13, replace:
var java_result = checkJavaVersion();
with
var java_result = true;
and save the file. This will skip the check on the Java version.
It is your responsibility to make sure you have JDK 8 or following on your machine, and that this version is used when you use the java command. You can make sure that's fine by checking with the command
java -version
Let's wrap it up:
pkgutil --flatten /tmp/a ~/a.pkg
At this point you have in your home directory a package called a.pkg. Double click on it, and the Netbeans installer will do its job.
This worked for me:
Start Java from fresh installation.
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/Java/JavaVirtualMachines
sudo rm -rf /Library/Application\ Support/Oracle/Java/
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
Restart computer.
Download and install Java jdk-8u271-macosx-x64
Restart computer.
Download and install NetBeans 12.1 from Appache Netbeans (sorry, Netbeans 8.2 didn’t worked anymore for me, though I tried at first).
Open Netbeans, do acepte import Netbeans 8.2 preferences.
Go to Netbeans Preferences pane under Netbeans menu.
Click on Java icon, then click on Java Shell... wait until Netbeans responds. Do accept any dialog (I forgot, but some dialog appears).
Netbeans will complain about jdk not being found; exit Netbeans.
Open file /Applications/NetBeans/NetBeans 12.1.app/Contents/Resources/NetBeans/etc/netbeans.conf with bbedit or something alike.
Find and edit line to this:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home"
Save file.
Open Netbeans; go to Netbeans Preferences pane under Netbeans menu.
Click on Java icon, then click on Java Shell. It may stay at blank square.
Close Preferences Pane; go to Tools menu: You’ll see Java Platforms menu, go into it.
There you have, all Java installment.
Hepoe this helps.
Its just the issue with netbeans jdk home path not to worry try this -
Step 1 - Open Terminal
/usr/libexec/java_home
Output - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
Copy this path as you have to save this in netbeans.conf
Step 2 - In terminal use this
nano /Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
search for netbeansjdkhome and paste the path you copied in STEP 1
Finally it should look like this -
netbeansjdkhome="/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"
Step 3 - Restart and open Netbeans 8.2 it will work fine now.
It's actually quite easy! But it was really hard to figure it out!
i'll tell it step by step:
STEP 1: First of all you have to make sure you set JAVA_HOME like this (depending on the version you have installed:
export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_275")
If you're just not sure what jdk version you have installed in, just do this:
/usr/libexec/java_home -V
STEP 2: Ok, now you have to download the whatever netbeans version you wanna install from apache's website. I needed 11.1.
STEP 3: Open up the dmg file and copy the pkg file into your home directory (you can use finder or whatever you want).
STEP 4: Execute the following command on your home directory (make sure to replace youruser and yourpkgfilename.pkg with the right information):
/usr/bin/sudo -E -- /usr/bin/env LOGNAME=youruser USER=youruser USERNAME=youruser /usr/sbin/installer -pkg yourpkgfilename.pkg -target /
You should get this output:
installer: Package name is Apache NetBeans IDE 11.1
installer: Installing at base path /
installer: The install was successful.
PS: See, i've signed UP to this RIGHT NOW, just to make sure to help everybody in the same problem here, i would really appreciate to be voted as the right solution if this really helps you ok?

No JDK found installing Apache NetBeans IDE on MacOS Big Sur

I'm trying to install Apache NetBeans IDE on my MacOS Big Sur, but it fails at the beginning
This is my java -version
I tried to edit the .profile or .bash_profile for the java_home as some people said in other answers, but it did nothing.
What I did here was the combining of the answers I received.
I installed the latest Apache NetBeans IDE which is the 12.1.
Right-click on : Apache NetBeans 12.1.app -> Show package contents
Go to : /Contents/Resources/NetBeans/netbeans/etc
Open 'netbeans.conf' with text editor.
Search for : #netbeans_jdkhome="/path/to/jdk"
Add the path to your JDK below like this :
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk-11.0.9.jdk/Contents/Home"
Save.
Run the program.
Try installing Java 8.
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
If you end up in Error: Cask adoptopenjdk8 exists in multiple taps: due to prior workarounds with different instructions, specify the absolute location like this:
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
Once the installation is complete, add JAVA_HOME to ~/.profile and source it.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
To install NetBeans IDE, issue
brew cask install netbeans
I So the procedures with setting java_home and that stuff did not work for me. What I did is download the binary zip from netbeans, and opened etc/netbeans.conf. In here, you can simply set the path to your JDK (netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home"), where you'll need to remove the # in front of this line. If you now run bin/netbeans in this folder, you can run netbeans. Let me know if this helps!
A better alternative i found is to install netbeans using homebrew package repository with command which will install netbeans on your machine.
brew install netbeans
Java is usually already installed in Mac OS. Netbeans installation sometimes is the problem. I had the same issue. I resolved it by installing netbeans using brew cask install netbeans. Use the command line instead of trying to download netbeans from the web.
I did this procedure: Installing Netbeans 8.2 on MacOS Big Sur no JDK found.
I installed Java 8 and Netbeans 12.1. I couldn’t install Netbeans 8.2, fortunately the installer imports Netbeans 8.2 preferences.
I used Netbeans 8.2 with JDK 8u111.
You can download this version of Netbeans in this link:
https://www.oracle.com/technetwork/es/java/javase/downloads/jdk-netbeans-jsp-3413139-esa.html

How can I install JRE from source?

I tried installing the latest version of JRE on my computer running ubuntu 20.04. JRE was not installed prior to this.
Here are the steps I followed.
headed to https://www.java.com/en/download/linux_manual.jsp
Downloaded the Linux x64 package, and, got the file named jre-8u261-linux-x64.tar.gz.
From my terminal I ran the following command; $sudo cp jre-8u261-linux-x64.tar.gz /usr/local/src to copy the file to the /local/src directory.
Inside the src directory I decompressed the package using$ sudo tar zxvf jre-8u261-linux-x64.tar.gz and got the directory jre1.8.0_261
No further instructions were given on installation and the JRE doesnt seem to be installed.
Perhaps you needed to unpack it into the usr/lib/ Try to do as in this video: https://www.youtube.com/watch?v=Zp10aJqj51M
jdk 8 includes jre, so if you don't want to install open jdk follow the instructions in the video

How can I build my Gradle project using a Windows JDK from Ubuntu on Windows?

My Windows 10 machine recently forcibly upgraded me to the new "Creators Update" version of windows, the "About your PC" widget now reports my OS version as "1703".
I thought I would have a crack at using the Windows Subsystem for Linux / Ubuntu on Windows to compile my Gradle projects.
I have a Windows JDK installed at c:\jvm\jdk1.8.0_102.
In my MinGW terminal window ("git bash"), I can setup a JAVA_HOME and execute the gradle wrapper script from my source directory and it will just work:
export JAVA_HOME=/c/jvm/jdk1.8.0_102
./gradlew tasks
But I can't figure out how to do an equivalent thing with WSL.
Opening up the "Bash on Ubuntu on Windows" terminal, changing to my source directory and invoking the following:
export JAVA_HOME=/mnt/c/jvm/jdk1.8.0_102
./gradlew tasks
Results in the following:
ERROR: JAVA_HOME is set to an invalid directory: /mnt/c/jvm/jdk1.8.0_102
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Note that the Windows JDK runs fine from within the bash terminal. Executing $JAVA_HOME/bin/java.exe -version in the Ubuntu terminal will work fine.
The question is:
Is there any way to run my gradlew script from a "Bash on Ubuntu on Windows" terminal using the Windows JDK I've previously installed.
Please note:
I'm specifically asking if it's possible to get my Gradle script running using the Windows JDK, not an Ubuntu/Linux JDK installed with WSL.
I understand I can likely run my gradle wrapper script by installing a Linux JDK within the Windows Sunbsystem for Linux, but I'm trying to figure out if it's possible to run my builds using the Windows JDK.
Just to make sure I didn't miss anything obvious, I downloaded Android Studio (which contains JDK, or rather, minimal set of Java tools to build Android projects) for Windows and Linux and installed them to 2 different directories: Windows version in C:\Program Files\Android\Android Studio and Linux version in ~/android-studio.
Inside WSL, I first set JAVA_HOME to C:\Program Files\Android\Android Studio\jre and ran gradlew. It gave me invalid directory error message.
Next, I set JAVA_HOME to ~/android-studio/jre. Everything worked as expected.
And then I copied Android Studio for Windows to ~/android-studio-windows and set JAVA_HOME to ~/android-studio-windows/jre. It gave me the same invalid directory error message, so I think WSL isn't able to use Windows tools as they are (well, at least not for the moment).
So, if your goal is to use gradle in WSL, I think you need to install OpenJDK for Linux (or something similar) inside WSL.
If you are using WSL and you want to run gradlew from WSL terminal then you can do it as follow:
cmd.exe /c gradlew --version
cmd.exe /c gradlew :help
cmd.exe /c gradlew app:dependencies
cmd.exe /c gradlew app:dependencies | grep -i "com.android.support"
I'm using windows version:
rdey#surface-book:/mnt/c/Users/rdey/git/ici$ cmd.exe /c "systeminfo" | grep "^OS Version"
OS Version: 10.0.17763 N/A Build 17763
If the question is reduced to: "how to run a windows binary from WSL".
The answer is: "you can't - that's not supported".
https://github.com/Microsoft/WSL/issues/333
https://github.com/kubernetes/minikube/issues/2140

Windows 7 cmd.exe can run java command ,but Intellij terminal Java command not found and error

Using Intellij IDE 15, I can't run java command, and Intellij IDE Terminal report that java is not recognized as an internal or external command. I'm confused why windows 7 CMD terminal can run normally? Intellij IDE can't do this.
Run command echo %Path% in the terminal and check that jdk bin folder is shown in command output. If it is not show then add %JAVA_HOME%\bin\ to the system environment Path and restart Intellij IDE or just restart Intellij IDE if Path variable contains necessary path.
In the terminal, are you in the jdk/bin folder before doing the command?
Check if $JAVA_HOME is set on the environment variables, also check if you have the correct path to the jdk in Intellij.

Categories