Getting Java to work with Windows 10 Ubuntu - java

I installed the Windows 10 Anniversary Update so that I could try Bash on Ubuntu on Windows. See how to install it. I wanted to see how performant it was. I then installed the Oracle Java JDK as per this article, so I could compare compilation times with the native Windows Java compiler.
I then tried to run Maven on my project, but it didn't work. Maven just hung starting. I noticed in Task Manager that the "java" process was hovering around 92% CPU.
So I tried something simple. I created a dummy Java Hello-world-like class and attempted to compile it with javac. Similarly, the "javac" process sat around 92% CPU.
I thought maybe it had something to do with running headless, but the -Djava.awt.headless=trueoption didn't make it any better.
Has anyone got this to work or have anything to try?
Update:
I also tried installing the Open JDK instead of the Oracle JDK (via sudo apt-get install openjdk-7-jdk) with the same result.

I figured it out. I couldn't use the download directly from Oracle. Instead I had to install it as per this link. Here are the steps:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

I had the same experience with the Windows 10 Anniversary Update. The first Fast Track Insider Build after the Anniversary Update and later support both the oracle Java 8 installer and the open JDK 7 installer. I just verified the java -version command still works on Insider Preview Build 14951 161014-1700 from the Ubuntu subsystem's bash shell. I have run other JVM based tools from bash shell as well but not extensively.
Here is a link to an issue, Cannot install Oracle JDK 8 #315, describing both installation and JVM hang issues tracked by the BashOnWindows project.

Related

macOS - How to install Java 17

Could someone please let me know the steps to install Java on a Mac.
I did brew install java
I get this
Warning: openjdk 17.0.1 is already installed and up-to-date.
To reinstall 17.0.1, run:
brew reinstall openjdk
If I do java -version, I get this.
openjdk version "13.0.8" 2021-07-20
If I have navigate to /Library/Java, I have 2 empty directories.
Where is java 17 installed??
In 2023, even if you can use just brew..
brew install openjdk#17
Java will be installed here:
/usr/local/opt/openjdk#17/bin/java
For the system Java wrappers to find this JDK, symlink it with:
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
...give a try to sdkman, it's far better than brew
curl -s "https://get.sdkman.io" | bash
then open a new shell and try list to see what you could install ;-)
sdk list java
At time of writing you could use:
sdk install java 17.0.4.1-tem
Java will be installed here:
/Users/freedev/.sdkman/candidates/java/17.0.4.1-tem
Java doesn't mind if you install multiple versions. This is often required; java is not backwards compatible (it tries to change little, but e.g. the java8 to java9 transition broke a ton of stuff, much of it needless and much of it not reasonably expectable or fixable by libraries and apps, so a bunch of java apps and libraries only run on java8 - just an example).
So, yes, you have installed JDK17. Also, yes, if you just run java without specifying which one you want, you so happen to get java13 here.
To see all installed javas, you can run:
/usr/libexec/java_home -V
to 'override', you can use something like (depends on which shell you're using on your mac):
export JAVA_HOME=`/usr/libexec/java_home -v 17`
(the backticks mean: Run this then take the output of it and treat that as the 'value' of the expression. here, assign it to the JAVA_HOME env var. -v 17 requests a path to java 17. The -V option lists all and is meant for your eyeballs, not for scripts. The -v option is mostly for scripting, and that's how we're using it here).
JAVA_HOME decides which java is used by some things, but the java you get when you just type java is /usr/bin/java, and that executable is actually just a wrapper that picks a java to run from amongst all installed versions. It uses JAVA_HOME to decide which java to actually run. There are wrappers for all the common commands (javac, too). You can always run e.g. which javac to see what that actually runs; you probably see /usr/bin/javac. Everything in /usr/bin is one of these wrapper thingies that looks at JAVA_HOME and then runs the binary it finds there.
To specify version 17
brew install openjdk#17
Later I add create a link:
sudo ln -sfn /usr/local/opt/openjdk#17/libexec/openjdk.jdk \
/Library/Java/JavaVirtualMachines/openjdk-17.jdk
And use jenv to control which java version to use
To used the version installed by homebrew rather than the one installed by the OS you can get detailed information from homebrew by typing
brew info java
Currently it states
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
openjdk is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides similar software and installing this software in
parallel can cause all kinds of trouble.
If you need to have openjdk first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk you may need to set:
export CPPFLAGS="-I/opt/homebrew/opt/openjdk/include"
For Homebrew, the package that installs the new AdoptOpenJDK is named as temurin. So you need to use below command:
brew install --cask temurin17
If you get any error like temurin cask not available then update brew using below commands:
brew update
brew tap homebrew/cask-versions
To switch quickly between different versions of java add the entries in bashrc as per your jdk versions like:
alias j8="export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version"
alias j17="export JAVA_HOME=`/usr/libexec/java_home -v 17`; java -version"
Steps to install
You asked:
let me know the steps to install Java on a Mac.
Download an installer free-of-cost from vendors such as Adoptium, Azul Systems, Bellsoft, Amazon, Oracle, Microsoft, SAP, and others.
Run installer app.
Quit the installer app when done.
Verify installation by typing on a command-line in Terminal.app:java --version
Delete installer app that you downloaded.
Configure your IDE to use that new Java implementation you installed.
Java location
You asked:
Where is java 17 installed??
/Library/Java/JavaVirtualMachines/
In the Finder, choose Go > Go to Folder, and paste /Library/Java/JavaVirtualMachines/.
Note that this is not the Library folder within your home folder. We are not referring to /Users/your_user_name/Library/…. We are referring to the root Library folder that applies across all the user accounts on this Mac.
You said:
I did brew install java
No need for the Homebrew package manager. If you already enjoy using the brew tool, proceed. But if new to Homebrew, skip it if your only goal is to install Java. Just use an installer for Java as you would for many Mac apps.
JavaFX
You added a tag for javafx.
Be aware that for JavaFX, you have two options:
Include the necessary OpenJFX libraries within your development project and within your final app, or …
Use a JDK that includes the JavaFX/OpenJFX libraries.
At least two vendors provide JDK installers that include the JavaFX/OpenJFX libraries:
Azul Systems (ZuluFX)
Bellsoft (LibericaFX)
This answer is specifically if you use Intellij on a Mac
Within IntelliJ, you can use the IDE to add new JDKs of selected versions from common vendors. Instructions for this are here:
Setup the project JDK
When setting up the JDK, you can either:
Select a pre-existing JDK which has been registered with the IDE OR
Use the Add JDK option to add a new JDK which you previously downloaded and installed using the method outlined in Basil's answer OR
Use the Download JDK option to choose a vendor and version of the JDK that the IDE will automatically download, install and make available for selection.
The JDKs installed by Idea will be located in the same location as outlined in Basil's answer for a manual install /Library/Java/JavaVirtualMachines/.
One common issue is that the version of the JDK registered for the project differs from the default version used in the terminal. This can sometimes mean that the app works when run in Idea, then fails when run in the terminal (or, at least that it is executed against a version of the JDK you didn't expect).
To select the version of the JDK to run in the terminal, configure the Java home setting as outlined in rzwitserloot's answer.
export JAVA_HOME=`/usr/libexec/java_home -v 17`
Also, some tools such as the openjfx maven plugin will not use the java version selected in Idea when executing a call to a JDK tool like jlink, but will instead have their own mechanism for finding a JDK to use (e.g. look at JAVA_HOME or use the Maven toolchains plugin). So it is always good to check the JAVA_HOME variable and ensure that it is set to a reasonable value, both for terminal execution and for effective use of Java development tools that may rely on it.
I think that answers here are not fully out of topic, but from my point of view, my case is exactly the same as that of the author. I had already installed java 8, 11, and 13. All of them resides at:
/Library/Java/JavaVirtualMachines/
Nevertheless when I tried to find the path of JDK 17 it resides:
/usr/local/Cellar/openjdk
I use Mac OS Big Sur and the JDK was installed with homebrew
Brew now supports searching old formulae and allowing you to install a specific version. I'm using Homebrew 3.5.2-117-gb941470
Create a local tap: brew tap-new --no-git local/openjdk
Ask Brew to find the formulae of the version you want: brew extract --version 17.0.2 openjdk local/openjdk
Install Java 17 using your new local tap: brew install openjdk#17.0.2
Link the JDK into the MacOS JVM Dir: sudo ln -sfn /usr/local/opt/openjdk#17.0.2/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk17.0.2.jdk
Check Java 17 is available: /usr/libexec/java_home -V
Set Java Home: export JAVA_HOME=$(/usr/libexec/java_home -v17)
Check current version of Java is correct...
$ java --version
openjdk 17.0.2 2022-01-18
The following method installs Java without the need for any additional tools or package managers.
Go to https://jdk.java.net/17/ and download the latest macOS archive.
Download the latest Adoptium release for the Java 17 branch by going to https://adoptium.net/temurin/releases/ and be sure to select the tar.gz version.
The archive is either for x64 (Intel CPU) or for AArch64 (Apple Silicon / M1 CPU).
Then, open a Terminal, and extract the downloaded archive to the system path for Java virtual machines:
cd Downloads
tar xzf OpenJDK17U-jdk_aarch64_mac_hotspot_17.0.5_8.tar.gz -C /Library/Java/JavaVirtualMachines

How to solve error java.lang.NoClassDefFoundError at the time of installing netbeans8 in debian

I am trying to install netbeans 8 in debian-7.0-amd64-minimal. (VPS)
1st I have installed java/JDK latest version (1.8.0_20) by following
https://www.digitalocean.com/community/tutorials/how-to-manually-install-oracle-java-on-a-debian-or-ubuntu-vps
Next I am trying to install netbeans by following
http://installnetbeansdebian.blogspot.com/2013/06/how-to-install-netbeans-73-ide-complete.html
when I run
./netbeans-8.0-php-linux.sh
it displays the following error.
Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"
Anybody knows, how to fix this?
Had a similar issue, for some reason the command
$ sudo chmod -x netbeans-8.2-javaee-linux.sh
didn't create executable file out of the script, so I had to use GUI method, as it shown here in the second answer:
https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-termina
then as the user Firestorm suggested just dropped sudo and it worked for me:
$./netbeans-8.2-javaee-linux.sh
Installed perfectly even created "Development" department in the "Application" menu and nested program start tag there. Debian-8 x64 KDE
Just had the same issue here (Fedora 25, Netbeans 8.2). It only occurs, when executing the installer as root which seems to be a problem with a root-privileged gui in a non-root-privileged environment.
Solution: Either install netbeans as normal user in your home directory OR launch the installer as root with the switch '--silent':
./netbeans-8.2-html-linux-x64.sh --silent
which will install netbeans in /usr/local.
Maybe late. For ubuntu 17
azuka$ : xhost +
azuka$ : sudo su
root$ : sh netbeans-8.2-php-linux.sh
I had the same issue on "Fedora 26". But I resolved it by repeating the same procedure but not as 'root' or 'sudo'. I.e:
Change directory to locate the downloaded file.
then.
$ chmod +x netbeans-8.2-linux.sh
$ ./netbeans-8.2-linux.sh
This question is nearly exactly two years old, but still actually occurred here just now.
I had this too on a Slackware system. I was trying to install it like you (because Slackware doesn't provide NetBeans packages) and I was typing in a virtual terminal window after executing su. The problem was the exact same as yours: I got the NoClassDefFound exception and the installer stopped. The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session. Java errors can be a bit cryptical, but the solution's as easy as that.
I hope this helps.
Simply close netbean if you open it already
1.install openjdk
2. download netbean
and where you download it use below command
$./netbeans-8.2-javaee-linux.sh
The solution was to execute the NetBeans installer as a normal user, or as the same user that you're logged in as in the X session
The solution was to execute the NetBeans installer as a normal user, or any user other than root.
define JAVA_HOME and JDK_HOME as environment variable
I had the same issue while installing Oracle Developer Studio via ssh X forwarding. I switched jdk from SE to 1.7.0 openjdk (update-alternatives --config java) and then managed to install. I hope it will help someone.
I have the same issue and I use:
sudo bash -x Apache-NetBeans-12.1-bin-linux-x64.sh --silent
and with this I coud install netbeans, but the version 12.1.
It is much easier (and more reliable and more secure) to use package management system to install software. All you need to do is to use the following command to install netbeans on Debian:
sudo apt-get install netbeans
Although netbeans version 7 will be installed (ver. 8 is not available from native Debian repository yet) you won't be struggling to make it work.
Besides please be careful with instructions to install java/JDK -- the method they describe is not the best. If OpenJDK is not sufficient for you then you might be doing something wrong. If you absolutely have to try Oracle's Java (unfortunately there are some corner cases when it might be needed) please use java-package to build your own Java package (.deb) from downloadable Java binary.

How to install JDK and Intellij IDEA on ARM/Samsung series 3

So I am very, very new to Linux. I am also new-ish to coding. I'm currently learning Java and purchased a Samsung series 3 Chromebook for the sole purpose of practicing code (eventually moving to slick 3d).
I have JUST installed XFCE using crouton and have gotten Firefox using the Synaptic Package Manager, woohoo!
I would like to find out how/which JDK I need for this device and how to install Intellij IDEA. I've tried searching around for a little while now and feel a bit overwhelmed with all the information regarding this, not only new OS, but new architecture (ARM).
Basically my main goals are to be able to get the proper JDK and a Java IDE up and running. I have read that Intellij IDEA may or may not be available yet for the ARM processors in which case using Eclipse would be just as fine.
A bit late but just did this myself. Very simple really: Go to https://www.jetbrains.com/idea/download for the latest version of idea. While it's downloading go to the terminal and type
sudo apt-get update && sudo apt-get install openjdk-7-jdk
Once Idea is downloaded and openjdk installed, extract the idea file somewhere.
mv ~/Downloads/idea-IU*.tar.gz ~
cd ~
tar xvf idea-IU*.tar.gz
To launch idea then just go to the extracted directory and run the idea.sh in the bin directory
cd idea-IU*/bin
./idea.sh
Should start up nicely
Update:
Saying it starts up nicely was not a lie. It just doesn't stay up long. Trying to see whats going wrong. Will update with findings.
OK, so you'll also need to do the following, open idea.sh and add -jamvm to the list of arguments used to run intellij,so change this line:
IDE_JVM_ARGS=""
To this:
IDE_JVM_ARGS="-jamvm"
ALSO, you'll need to install clang ( sudo apt-get install clang ) and copy and run ( bash <scriptname>.sh /path/to/idea/bin ) this guy's shell script : https://gist.github.com/pcarrier/7560053#file-fsnotifierto-sh
OpenJDK is available in Ubuntu, and the Oracle Java SE Development Kit can be downloaded from Oracle. For the latter, you would need the "hard float ABI" version.
http://www.webupd8.org/2013/12/oracle-java-ppa-updated-with-arm-support.html might be a more user-friendly way than downloading the Oracle environment yourself.
Eclipse exists in Ubuntu too.

Eclipse on Mac 10.8 - Installed 1.7.0 JRE / JDK, but Eclipse won't launch

Installed Java SE 1.7.0u10 from Oracle w/ their installer package
Downloaded and unpacked Eclipse Juno (4.2.1)
Double click Eclipse purple icon and get OS X alert prompt with error message:
To open "Eclipse," you need a Java SE 6 runtime. Would you like to
install one now?
(in terminal) which java - /usr/bin/java
ls -l /usr/bin/java - /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
(in Finder) Double click eclipse alias (included when unpacked download) - Terminal launches, /Applications/Eclipse/Eclipse.app/Contents/MacOS/eclipse ; exit ; and Exclipse launches without OS X alert prompt.
I've tried modifying the Eclipse app bundle plist to point the -vm key to /System/Library/Frameworks/JavaVM.frameworks/Versions/Current/Commands/java, but I feel like I probably shouldn't have to do this.`
I'd like to know how to get Eclipse to launch by just double clicking on the Application package. It's such a small thing to bug me... :o)
The best answer is to fix the Java 7 installation as shown here :
https://stackoverflow.com/a/19594116
Simple to do and I have confirmed it works on Mavericks. With this fix, you can launch your app from the launchpad as usual. If you upgrade your JDK, you will have to reapply the fix to the new installation.
I had JDK 7 installed and I solved this issue for eclipse Kepler by running eclipse from the terminal instead of the finder.
./eclipse
Just thought to share.
Update 1
For the sake of completeness, if you want to run it from Finder as well, you can wrap the ./eclipse command into a .command file and run it from Finder (so that you don't have to open a terminal)
The following lines should do the job (don't forget to replace "your-full-eclipse-path" with the eclipse path on your machine)
#!/bin/sh
/your-full-eclipse-path/eclipse
After that, give execute permission to the eclipse.command file you just created
chmod +x eclipse.command
I found the answer over on Ask Different
It's an ugly hack, but works perfectly.
posted on this page: Mountain Lion with Java 7 only
To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:
sudo mkdir /System/Library/Java/JavaVirtualMachines
sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
Most Java Programs will run with this little hack without the need to install Java 6. OS X's Java Preferences (and maybe some others) will not as it seems to explicitly check the version of the JVM when it is started.
script above can fix my problem.
Hoping you are using 64-bit of Java SE 1.7.0 and so advising the following.
go to Eclipse->Preferences...->Java->Installed JREs
click Add...
Select Standard VM
paste /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home into JRE home
Change the JRE name to something useful like Java SE 7
Click Finish
Check the check-box next to your newly created JRE.
You would need a restart.
For what it's worth, the Eclipse team seems to have worked around it by replacing their dlopen()-based method with a CFBundleCreate()-based one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361
In case anybody has the same problem in their code that launches Java and does not want to resort to Apple-only APIs, I found an easier work-around: before dlopen()ing $JRE_HOME/lib/server/libjvm.dylib, make sure to open dlopen() $JRE_HOME/lib/jli/libjli.dylib. Then it won't ask to install Java 6.
Can you imagine that? You have to install a JDK 1.6 to get eclipse ran properly, even if you already have jdk 1.7 installed, and set the JAVA_HOME properly.
To resolve your issue, you just need to download the jdk1.6 from http://support.apple.com/kb/DL1572?viewlocale=en_US, and install it, later you will be able to run eclipse, and you can set the JAVA_HOME to JDK1.7, and you will be able to find the JDK1.7 from eclipse "Preferences".
All these hacks does not work on mac Mavericks,
But a simple and efficient solution is found here
it worked with me like a charm.
Note: a drawback of this solution is when you check your java version using "java -version" command, it will read Java 1.6
open /Library/Java/JavaVirtualMachines/jdkXXXXX.jdk/Contents/Info.plist
settting(<string>BundledApp</string> is usefull!):
<key>JVMCapabilities</key>
<array>
  <string>JNI</string>
  <string>BundledApp</string>
  <string>WebStart</string>
  <string>Applets</string>
  <string>CommandLine</string>
</array>
I had the exact same message when setting up a new mac and trying to run eclipse 4.2.2 with only Java SE 7 installed (as part of JDK 7u17).
In order to be able to successfully launch Eclipse I had to let OSX download and install Apple's Java SE 6 runtime first before installing the latest JDK.
After installing the JDK, the command java -version correctly shows:
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
Trying to solve the problem the other way around didn't work -- i.e. installing JDK 7u17 first before installing Java SE 6 as suggested in the message.
I had the exactly same problem some days ago and I solved it today. Just installed this http://support.apple.com/kb/dl1572
And after that, when I opened the eclipse the OSX installed some java update and opening eclipse by Eclipse.app started working.
Hope it works with you too.
If you'd like to install Java 6 JDK only (no Java 7 JDK/JRE, no Java 6 JRE only), install the Apple OSX Java DMG (at time of writing, this was http://adcdownload.apple.com/Developer_Tools/java_for_os_x_2013003_developer_package/java_for_os_x_2013003_dp__11m4406.dmg).
You still won't be able to start Eclipse. Make a directory JavaVirtualMachines under /System/Library/Java. And then make an Alias of the java version folder at /Library/Java/JavaVirtualMachines and rename the alias 1.6.0.jdk and copy that alias to /System/Library/Java/JavaVirtualMachines/
After finished, you will have an Alias at /System/Library/Java/JavaVirtualMachines/1.6.0.jdk that points to the Java install directory at */Library/Java/JavaVirtualMachines/1.6.0_XX-XXX-XXX.jdk*
Install latest JDK from Sun, it installs into /Library/Java/JavaVirtualMachines/, e.g. /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk
sudo mkdir /System/Library/Java/JavaVirtualMachines
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/ /System/Library/Java/JavaVirtualMachines/1.6.0.jdk
========= this trick used to work on Mountain Lion, but not on Maverick 10.9 somehow ============
Tried this again on Maverick, it does not work anymore. I also tried to change eclipse app plist and eclipse.ini (by adding -vm or ), does not work either.
Some people suggested that this is caused by Eclipse binary prepared using Apple 1.6 appbundler instead of Oracle java7 appbundler: Application is using Java 6 from Apple instead of Java 7 from Oracle on Mac OS X?
For now, please just type the eclipse from command line, which works fine with JAVA_HOME set to Java 7 (/usr/libexec/java_home command will tell you)
How to Make Eclipse Run on OS X 10.9 Mavericks
Attempting to launch various Eclipse versions after the Mavericks upgrade pops up a dialog with this message:
To open "Eclipse.app" you need a Java SE 6 runtime. Would you like to install one now?
It turns out that Java 7 is disabled by default in OS X 10.9.
This is easily verified as follows:
$ java --version
No Java runtime present, requesting install.
The solution is to install the latest supported Java version from Apple support: Java for OS X 2013-005 (http://support.apple.com/kb/DL1572)
As of 10/15/13 this would be Java SE 6 1.6.0_65.
Post Date: Oct 15, 2013
File Size: 63.98 MB
After the install, Eclipse will run as expected from the Dock, the Finder, or the Terminal without any tricks, hacks, or work-arounds.
I wanted to run Eclipse itself with Java 7. As I have a couple of plugins that do not work without it. For me neither solution worked for 10.9, but I found a workaround. The main idea is that you start eclipse with java -jar launcher.jar and provide a couple of magic properties and then it starts. This guy provided the command line script in comments that works for me:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361#c25
I found the same problem (Mac OS X 10.9.2, Java 1.7.0_53b13, Eclipse Kepler). The workaround was quite easy:
Find the executable in Finder (CMD+Click on Eclipse's icon in the Dock)
Remove the icon from the Dock
CTRL+Click on the executable in Finder
ALT+Open (to allow the execution of a non-signed application)
Eclipse opens normally and without any problem
Re-dragged the program onto the Dock
I had this problem and found that I did not have JDK installed on my Mac. Once I did that, Eclipse starts normally.
I had same problem.
First of all ; JDK(java development Kit) and JRE(Java Runtime Environment) are different things. It was confused by people
In order to install eclipse yo should install latest JDK . So
Visit
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download suitable version for your mac
You can check your version now ; it won't be 1.6 anymore
Try to install eclipse again , see it works.
Good luck!..

Getting started Java with Linux OS

I know this is very basic question, but these days I have done all my Java programs on Windows OS. But now I like to go with Linux.
How JDK and all be installed in Linux OS?
I am using Ubuntu 10.04 LTS.
That is dependent on the distribution you are using -- provide more details so people can be more helpful.
In most distributions however this is as simple as installing a package from the official repositories.
For example, in Debian/Ubuntu etc. you can do:
sudo apt-get install sun-java6-jdk
which will get you both the JDK and the JRE which is a dependency.
On Ubuntu:
$ sudo apt-get install openjdk-6-jdk openjdk-6-demo openjdk-6-doc
gets you the SDK, its demos and documentation. You should then be able to run the first set of examples.
It depends on your distribution. In Ubuntu you would do something like this (as root)...
# aptitude search jdk
After your choice, you install it.
# aptitude install sun-java6-jdk
Don't bother about downloading anything from any website. The package manager (apt-get, aptitude) is doing that for you.
Many Linux distributions package the OpenJDK into their repositories so you can install Java like any other application. If you want the Sun version of Java then you can download a bin or rpm file directly from Sun/Oracle that you can install manually.
The Sun/Oracle version can be found here: http://java.sun.com/javase/downloads/widget/jdk6.jsp Just select Linux as your platform in the form.
In addition to others' answers: If you need Java packages beyond what your distro provides, then check out the JPackage project. JPackage provides RPMs (so it won't work on Debian or Ubuntu, unless you use Alien) of a large number of Java libraries, frameworks, and tools.
As people have noted, you can use apt-get to install the JDK:
sudo apt-get install sun-java6-jdk
Also, if you're looking for a graphical editor, Eclipse is a good one, especially when you're not very familiar with Unix operating systems. It also should come with the JDK included with the default install. You can download that with:
sudo apt-get install eclipse
As Tedil mentioned, you can also get this without the console work via Ubuntu's Software Center in the Applications menu from the top bar.

Categories