Eclipse only sees JDK with sudo - java

I have to start by saying that I have just switched to Ubuntu from Windows and I am new to Linux in general. Coming from Windows, I really am not familiar with how exactly the permissions work, the Linux file system, where I am able to create folders that I can use without the sudo command etc.
I use eclipse on a daily basis for android development and other simple java swing projects. I was able to download and extract the latest available version of eclipse (kepler) to this path: /opt/eclipse. Inside this directory is the eclipse executable and other eclipse related files.
I also installed the JDK and verified with the java -version command. It says:
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
I am running on a 64 bit CPU architecture so both programs are the 64 bit version.
Now, my problem is that if I open eclipse from the Unity dash or from the file explorer, it give me this error:
However if I run sudo eclipse in the terminal, everything runs just fine as long as I do it as the super user. I have a hunch that the JDK is installed in a folder that is restricted to normal users and only works if I run the sudo command but this is just a hunch. As I said, I am new to Linux and I am not really sure what I am doing wrong here, I am learning as I go. I need a good explanation as to how to make it start from the Unity dock without the sudo command. Thanks in advance!

You'll want to use the chmod command from the terminal to change the permissions on the Java folder. See this link for more information:
http://www.linux.org/threads/file-permissions-chmod.4094/

Well after running the which java cmd, I noticed that the path to the JDK from the eclipse.ini file was not pointing to the correct location. I fixed the path and now it works. I don't know how the sudo cmd overrides the eclipse.ini path to JDK but well, it works

Related

How to install eclipse neon version for 32 bit system in ubuntu 14.04

I downloaded eclipse neon version from here
elipse-neon for 32 bit
When i tried to run eclipse,error i am getting is:
ujjwal#ujjwal:~/Downloads/eclipse$ ./eclipse -vm /usr/bin
Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /home/ujjwal/Downloads/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.401.v20161122-1740/eclipse_1618.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized. Will retry after the state location is initialized.
My system is 32 bit. And java version is:
ujjwal#ujjwal:~/Downloads/eclipse$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Problem 1: Why java HotSpot server is 64-bit? Will it work with my system which is a 32 bit system.I think the error is related to this.
Problem 2: How to launch eclipse neon with java 8 support. What am i missing.?
PS: I have tried this, this and this, but nothing worked for me.
Download eclipse-java-neon-2-linux-gtk.tar.gz click here
than
Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, run the command below to extract Eclipse to /opt/:
cd /opt/ && sudo tar -zxvf ~/Downloads/eclipse-java-neon-2-linux-gtk.tar.gz
You may replace “eclipse-*.tar.gz” (without quote) to the exact package name if the command does not work.
Don’t like Linux commands? You can do this by opening Nautilus file browser via root: Press Alt+F2 -> run gksudo nautilus.
Once done, you should see the eclipse folder under /opt/ directory.
Press Ctrl+Alt+T, paste below command into the terminal and hit enter (install gksu from Software Center if below command does not work).
gksudo gedit /usr/share/applications/eclipse.desktop
Above command will create and open the launcher file for eclipse with gedit text editor.
With regard to the answer by Raj: installing Eclipse with root permissions is not recommended, because Eclipse prefers to update configuration files inside the installation. If that's not possible, any configuration updates are written to ${HOME}/.eclipse/ which is sligthly restricted in several regards.
In particular selecting the correct JVM to run Eclipse can be done via editing eclipse.ini.
EDIT: In fact much installation hassle can be avoided by using the installer, see the corresponding box on the download page, which has a nice explanation when you click on Find out more.

Android Studio Setup - could not detect JDK

I'm trying to install the Android Studio on my Windows 7 notebook, but even when I filled the path with the JDK, occurs the following error:
I already set the environment variables JAVA_HOME, PATH, reboot the notebook, but still have problem. I'm using the "android-studio-bundle-141.2456560-windows" version and also the "jdk-7u79-windows-x64".
Could you please, help with this issue?
Have you tried to run java.exe -version in a terminal, if the jdk is installed it should return something like:
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
if not, you might want to reinstall it and reset the path.
What you might also want to do, is go to the jdk location and make sure it contains a directory named bin and see if it has the java.exe file in it.
In this link Android Studio ZIP, I did the download for windows after unzip all the file, I started execute the "studio.exe", that is inside the bin folder.
Thanks everyone for the help.
I downloaded Android Studio for windows, then I unzipped all the file. I started executing the "studio.exe", that is inside the bin folder. It worked.
Thanks everyone for the help.
#Victor W. Vieira this works fine for me. On Windows Professional x64-bit system.

Installing JNLP on Ubuntu for Open JDK 7

How do I get JNLP working for OpenJDK 7 on a Ubuntu machine?
I'm trying to get the source code linked to at http://www.bugaco.com/bioinf/clusterer/ with the text "Download sources" to run on my machine.
Currently, when I try running
javac -cp ".:l2fprod-common-all-7.3.jar:jfreechart-1.0.17/lib/jfreechart-1.0.17.jar" com/bugaco/mioritic/impl/module/project/Main.java
it is giving me the error
./com/bugaco/ui/LoadBean.java:11: error: package javax.jnlp does not exist
import javax.jnlp.FileOpenService;
^
(and many other errors)
which I assume indicates that I need to install JNLP, along with other packages I'll have to install when I get JNLP fixed.
Based on Mike Clark's answer https://stackoverflow.com/a/12608844/38765
I assumed that "Demos and Samples" is the way to install JNLP for Open JDK 7.
I'm on Ubuntu, so I'm trying to use the "Ubuntu way" to install it. I installed openjdk-7-demo , which describes itself as "Java runtime based on OpenJDK (demos and examples)".
It's still giving the error described above. What have I done wrong, or forgotten to do?
I tried browsing the tag wiki for java. The only non-video resource that looked relevant to me in "Beginners' resources" was "The Java Tutorials". The only link relevant from there was "Learning the Java Language". It had a section on packages, but that's only on how to create your own, rather than how to install other peoples' packages.
I'm using Ubuntu 12.04 (precise) 64-bit, and Java 7
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1~0.12.04.2)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
If you want to use JNLP with OpenSDK, you need the IcedTea implementation of JNLP.
In Ubuntu, install the "icedtea-netx" package.
The libraries you need will be in /usr/share/icedtea-web/.
Just use $ javaws xxxxx.jnlp .
It works to me on :
(open-jdk-7 + Ubuntu 14.04)

Adobe Flash Builder 4.7 Startup Failed with "Failed to create the Java Virtual Machine"

When I try to start Adobe Flash Builder 4.7, it keeps giving me the following error:
Failed to create the Java Virtual Machine
Before it was working perfectly. The problem started to occur after I set up my MacOSX for a new project. But I didn't change any *.ini file in the Adobe Flash Builder 4.7 installation directory.
I Googled a lot, everyone gave the similar answer: change the *.ini files. I found 3 files:
/Applications/Adobe Flash Builder 4.7.app/Contents/MacOS/Adobe Flash Builder 4.7.ini
/Applications/Adobe Flash Builder 4.7.app/Contents/MacOS/Adobe Flash Builder 4.ini
/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini
I tried to change the following values as instructed:
-Xms512m
-Xmx1024m
-XX:MaxPermSize=256m
-XX:PermSize=64m
But not working at all. So what values are you guys using if my physical memory is 4GB? (my MacOSX has 4GB memory).
BTW, I did (re)install Java when setting up my MacOSX for a new project, and here is my java info:
[plee#pleemac ~]$ which java
/usr/bin/java
[plee#pleemac ~]$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
[plee#pleemac ~]$
This is ridiculous! But I'm not sure. It seems Adobe Flash Builder 4.7 does NOT support Java 1.7.
After I install Apple's Java 1.6 from:
http://support.apple.com/kb/DL1572?viewlocale=en_US
I am able to open Adobe Flash Builder 4.7.
Hmmm, now I need to install Java 1.7 in a very special way for my new project. Actually I don't know how. But Thank god, I finally could use my Adobe Flash Builder 4.7 again!
I have a solution on Sierra for Flash Builder 4.6:
I'm just set JAVA_HOME environment to java 1.6
install java 1.6 from here: https://support.apple.com/kb/DL1572
from terminal:
cd /Applications/Adobe\ Flash\ Builder\ 4.6/eclipse/Eclipse.app/Contents/MacOS/
export JAVA_HOME="$(/usr/libexec/java_home -v 1.6)"
./eclipse
It works for me.
I was having the same issue. I started eclipse from the terminal (see below) and saw that the JavaVM was complaining about a library from an old version 1.7JDK. When I Looked in /Library/Java/JavaVirtualMachines I saw that after performing updates on the JDK, the old installs (and updates) were still installed. I uninstalled all JDK installation folders except for the most recent. See Oracle site for uninstall instructions (you basically just delete them) http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html
To open Eclipse from terminal, enter: cd /Applications/Adobe\ Flash\ Builder\ 4.7/eclipse/Eclipse.app/Contents/MacOS/
then enter: ./eclipse
I just installed java 1.6 from here: https://support.apple.com/kb/DL1572, and FlashBuilder 4.6 on MacOS Mojave is functional again.

JRE error when trying to install Matlab Compiler Runtime

Once again, I spent much time trying to get something to work without success.
I want to install MATLAB Compiler Runtime on my Ubuntu 13.04, where there is no MATLAB installed.
Here's what I did:
I downloaded the 64-bit Linux version R2012b(8.0) off of
http://www.mathworks.com/products/compiler/mcr/index.html?s_cid=BB.
Then, I switched into the folder and tried to install via
sudo ./install just to receive the following message:
Error: Cannot locate Java Runtime Environment (JRE).
The directory /home/konni/Downloads/MCR_R2012b_glnxa64_installer/sys/java/jre/glnx86/jre does not exist.
And, it does not exist indeed, but there exists a folder with "glnxa86" instead of "glnx86". I wouldn't just want to rename it, though.
I do have a JRE installed on my machine, btw:
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK Server VM (build 23.7-b01, mixed mode)
I have absolutely no clue what to do. The problems I found using google didn't quite help me, either...
Maybe you have an idea?
I'd greatly appreciate any help! :-)
If the only problem is finding the JRE, then the command line switch -javadir will get you done:
./install -javadir /usr/lib/jvm/java-7-openjdk-i386/jre/
I had the same problem recently when installing a software that required a 7.13 MCR on an Ubuntu 17.10.
In this
https://www.linuxquestions.org/questions/linux-newbie-8/matlab-7-5-compiled-runtime-for-64-bit-linux-installation-no-jre-error-838281/
I found that the 32 bit version installs fine, and it did, but obviously, that didn't solve my problem.
However, I found a way to do it. The trick is that the installer needs the old JRE (1.5) and will not work with JDK 8.
So the first step is to run
./MCRInstaller.bin -is:extract
this will create a directory called istemp... something, for me istemp23732345211606.
ls
jre1.5.0-linux-amd64.bin JVMNotFound.txt setup.jar Verify.jar
It is tempting to run the setup.jar directly, do try, but with Java 8, I only got the following error message:
Could not load wizard specified in /wizard.inf (104)
But perhaps it will work for you. People who get the above mentioned error with wizard.inf should look further, because the installer needs JDK 5 to run.
I chose not to use the bundled version but downloaded the JDK 5 from Oracle. The bundled version might work as well - I did not try.
You can download JDK 5 from here:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html#jdk-1.5.0_22-oth-JPR
Extract the downloaded archive (chmod +x the bin and run), then copy the files to /usr/lib/jvm/java5
Rename the jdk1.5.0_022 or anything to jdk1.5.0 to make it simple.
Fix attributes:
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/java5/jdk1.5.0
Then run:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java5/jdk1.5.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java5/jdk1.5.0/bin/javac" 1
Now chose the jdk 5 as default
sudo update-alternatives --config java
And selecting the appropriate option.
Check that it worked
java -version
You should see something like this:
java version "1.5.0_22" Java(TM) 2 Runtime Environment, Standard
Edition (build 1.5.0_22-b03) Java HotSpot(TM) 64-Bit Server VM (build
1.5.0_22-b03, mixed mode)
Now you can run the setup.jar file in the extracted directory (istemp...)
sudo java -jar setup.jar
I recommend that you chose a contemporary java by running
sudo update-alternatives --config java
again.
When running the installer.sh, use the command line option "-is:javahome [path to your java jre folder]".
For instance, I installed below a java 8 jre on an old matlab compiler 2007b as follow:
sudo /opt/installer.sh -console -is:javahome /usr/lib/jvm/java-8-openjdk-amd64/jre/
I had same problem. The problem is you are installing 64-bit matlab on 32-bit ubuntu. use 32-bit matlab and install in ubuntu 32-bit. use 64-bit matlab and install in ubuntu 64-bit. Please like the answer if it was helpful.

Categories

Resources