I have installed Java for RedHat Linux 5 ( 64-bit version) using online guide.
After the installation, if run the below command to check java, it is giving the
error: "bash: /usr/bin/java: cannot execute binary file"
Command used: #java -version
My installation process didnt throw any errors.
Please help me in identifying the problem.
This could be either a wrong binary (32bit version?) or it can be a mismatch between a wrapper command expecting java to be a shell-script and the actual java beeing a binary. You say, you used the online guide, can you tell us what command you used? Did you install OpenJDK or IBM JDK with yum or did you use Oracle archives?
What does "file /usr/bin/java" and "which java" and "echo $JAVA_HOME" tell you? Also add output of uname -a to make sure you really run 64bit kernel. Try to run the java directly (/opt/jdk/bin/java or whereever it is installed).
Related
Java -version in Linux is not seem to be working and returing -bash: java: command not found error,though im able to run java related apps.
I have installed jdk in my new linux machine and i have set the environment variable JAVA_HOME using which i can execute JAVA apps and I can echo the java path i set.
Problem is i can not see the java version i have installed ,using the command java -version (i want to know that everything is set fine)
can someone guide me ,what i am missing here.
You should have your java installation directory added to PATH environment variable in order to use java from terminal. For example:
export PATH=<your java Directory>/bin:$PATH
I am using MobaXterm, a friendly Unix terminal that runs on Windows. I want to compile a simple Java program using the javac command. After looking at plenty of other forums, I know I need to use the path where Java is installed, but no matter what I try, I keep getting the error
javac command not found
on the terminal. Can someone please help me out with compiling basic Java programs from within their directory on a Unix terminal on Windows?
And yes, I have JDK for Windows installed on my computer, I just don't know how to use it when compiling through the terminal.
By default, MobaXterm does not preserve Windows PATH environment variable: this is why you obtain
command not found
when running javac.
In order to tell MobaXterm to preserve Windows PATH, you just have to go to Settings --> Configuration --> Terminal tab and check Append Windows PATH environment variable option.
You can try cygwin first of all. Is another terminal that runs on windows.
With this command 'sudo apt-get install openjdk-7-jdk' at linux installs the jdk
And after this you can compile your program. sudo is for administration privilages.
I want to install the JDK in cygwin on my windows machine. I am downloading the linux version of JDK from oracle site using wget command. Here is the list of commands I am running to install JDK:
wget http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-x64.rpm.bin
chmod a+x jdk-6u31-linux-x64.rpm.bin
./jdk-6u31-linux-x64.rpm.bin
All these instructions are same as suggested by Oracle for installing JDK over here but I am getting the following errors:
Firstly, those messages indicate that what you are trying to execute is an HTML document! In other words, the download has failed and given you an error page rather than an installer.
However, assuming that you succeed in downloading the (Linux) installer, it is unlikely that it will install properly, and there is about ZERO chance that the installed tools will run. Applications that have been compiled for Linux don't run on Cygwin.
What you need to do is to download and install the JDK for Windows, and then tweak your cygwin profile a bit. This page explains: http://horstmann.com/articles/cygwin-tips.html.
(If you Google for "java cygwin" there are various other tips for making Java work from Cygwin. However, in my experience there are a few rough edges ... due to the fact that the Windows Java utilities expect to have been called with windows-style arguments, pathnames, classpaths, etcetera.)
Hello good people of Stack Overflow, I have come with yet another question for your bountiful knowledge to answer. I am having a problem using eclim, a program that integrates the features of eclipse for java development into the Vim editor.
I am unable to create a project using the syntax defined on eclim.org, which is this vim command, ":ProjectCreate /path/to/dir -n java". I am typing this like this, ":ProjectCreate /home/username/Java -n java", where username is my username. The error I get is,
Java Model Exception: Java Model Status [Java does not exist]
while executing command (port: 9091): -command project_create -f "/home/username/Java" -n java
This led me to test if Java was installed on my system, using java -version. The output is,
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.1) (6b22-1.10.1-0ubuntu1)
OpenJDK Server VM (build 20.0-b11, mixed mode)
So I had Java installed, and I believe that is the OpenJDK version that is not used in my eclim installation. The version I specified is Java 1.6.0_24 of the sun Java JDK. That's beside the point though, as I do have Java installed.
So that's what led me to you. One last thing I would like to add though. I am using a headless server to run the eclim server in the background. This is through Xvfb, and is also detailed on eclim.org. I don't believe that is causing the problem, but I just thought it would be handy to throw in. As always, thanks for the help that will doubtless be provided.
I have done further testing and my original comment was not the correct reason. The real problem, was that I already had a directory at ~/Java. That tried to execute that directory for the project, which it could not do.
I have installed jdk1.6.0_21 and sqldeveloper(using alien) on debian(lenny). Now when I run sqldeveloper it asks for J2SE installation path, after I type the jdk path it exits with the below error message.
Oracle SQL Developer
Copyright (c) 2008, Oracle. All rights reserved.
Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.sqldeveloper/jdk
/usr/java/jdk1.6.0_21
/opt/sqldeveloper/sqldeveloper/bin/../../ide/bin/launcher.sh: line 430: /root/.sqldeveloper/jdk: No such file or directory
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Error: SQL Developer can't recognize the JDK version
You might want to issue the following command:
echo '/usr/lib/jvm/java-6-sun' > ~/.sqldeveloper/jdk
also it can be
/usr/lib/jvm/java-6-openjdk
on the sqldeveloper home there is a file named sqldeveloper.sh (or datamodeler.sh) add the folowin line:
unset GNOME_DESKTOP_SESSION_ID
should be look like this:
#!/bin/bash
unset GNOME_DESKTOP_SESSION_ID
cd "`dirname $0`"/sqldeveloper/bin && bash sqldeveloper $*
That's all.
Adios
There are several possible causes for this error message:
The VM can't find the rt.jar file
The VM and the rt.jar file don't match (e.g. VM is version 1.6.x, rt.jar is version 1.4)
The JDK wasn't installed properly
What's the output of the following commands?
which java
java -version
/usr/java/jdk1.6.0_21/bin/java -version
Finally I found the problem, JDK was not installed properly. I installed a fresh copy of OpenJDK after that it is working fine.
I've got the same when i will install my SQL Developer as root, but use it as other user.. In my case looks like the Sql developer was makes file ~/.sqldeveloper/.... as root:root privilegies, but in home dir with sudo user.. It's strange but easy to fix as
chown youruser:yourgroup -R ~/.sqldeveloper
When you get several error messages that don't seem to make any sense, start by looking at the first error. In this case, that would be:
/root/.sqldeveloper/jdk: No such file or directory
It looks like sqldeveloper is trying to write the file, and failing. Are you running this as root? If not, can you think of any reason why sqldeveloper would think that your home directory is /root/?
It looks as if the two java versions (OpenJDK accessible via /usr/bin/java and JDK 1.6.0_21 get mixed up). I can only guess how it can be solved:
run update-alternatives --set java /usr/java/jdk1.6.0_21/bin/java
try to uninstall OpenJDK
possibly, you need to do both
Only replace in /opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf
from:
SetJavaHome ../../jdk
to:
SetJavaHome /usr/lib/jvm/java-7-openjdk-amd64