I am using UBUNTU 11.0.7 with softwares JDK7, but when iam trying to execute a simple java program from command line it again asks me to install jdk version , can anyone please help me out..
after install your jdk and set your path variable, write java -version to know that is java installed properly
then run your .jar file with java -jar yourfilePath
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'm trying to make Standford NER package to work on my mac. Using anaconda and python 2.7 (iPython notebook). I was following the steps given here:
http://www.nltk.org/api/nltk.tag.html#module-nltk.tag.stanford. While executing the last step, it gave me UnsupportedClassVersionError.."xy.z" is "52.0" which means I need to upgrade to java 8.
I upgraded to Java 8, but my java -version command still showing java 7. So I tried to fix it using the solution given here: After upgrading to Java8, javac still shows 1.7. Instead of removing, I renamed the directory. These are the following commands I exec:
cd /System/Library/Frameworks/JavaVM.framework/Versions/
mv Current Current_Old
ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/ Current
Then after that java -version command is not working. I realized the directory name is incorrect and tried to replace it back using mv Current_Old Current, still the command is not working.
how can I restore my java?
Able to get it working again! All I did was restored legacy Java 6 from this link: https://support.apple.com/kb/DL1572?locale=en_US
Then java -version was even showing me the latest version which is Java 1.8. Able to start Java IDE now.
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).
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.
So I have the latest version of JRE 7 on my computer, and everything is working fine. Lately, I've downloaded a program that requires JRE 6. I know where all of the files are located on my computer, all I'm asking is the .bat file code to run a specific version of Java with only that program. I am somewhat of a newbie when it comes to Windows and Java PATH structure, so
Stanford's computer science course has you use a modified version of Eclipse to code in Java, and it was created when Java was still in version 6. If you are familiar with this, then you may know of karel the robot, a Java application that opens in Eclipse. When I tried to run this, the Karel program did not appear; only a blank screen. I found a youtube video about using Karel and many of the people in the comments had been having this problem, and some said that using JRE 6 fixed it. Also on the installation instructions, it said to use JRE 1.6, but I thought it would work with JRE 7
you can call each java.exe directly.
You can create 2 batch file named java6.bat and java7.bat :
java6.bat
#echo off
"C:\Program Files\Java\jre6\bin\java.exe" %*
java7.bat
#echo off
"C:\Program Files\Java\jre7\bin\java.exe" %*
to call a program with jre6
java6 -jar helloworld.jar
and to call a program with jre7
java7 -jar helloworld.jar
If you mean this program then I had no problem launching it with java 7
However if you really need java 6 for operating it then you could write some .bat file like this:
#echo off
set JAVA_HOME=C:\oracle\jdk1.6
set MY_CLASSPATH=lib\karelj.jar;lib\silk.jar
%JAVA_HOME%\bin\javaw.exe -cp %MY_CLASSPATH% karel.swingui.Main