How to update Jre and Jdk

I am trying the try with resource statement:

    try(ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(defaultFile)))
    {
        ;
    }
    catch(IOException e)
    {
        ;
    }

But I get syntax error, which makes me think that I need the newest version of Java. So I have downloaded the latest Jre and Jdk from Oracle site, but I don't know how to effectively substitute the new Jre and Jdk with the older ones. I have tried from eclipse windows->preferences->installed JREs, the is the option "search".But If I try searching in the directory where I have Jre and Jdk files, it says that no valid Jre was found. How to effectively update Jre and Jdk? PS:I am on ubuntu 10.10

Answers


First, make sure you are using the latest release of Eclipse (Indigo SR2, aka 3.7.2); full Java 7 support wasn't available until Eclipse 3.7.1

Now, on the Installed JREs preferences page, are you using the Add... button to point to the root of your JDK installation? Describe the steps you have taken to get the "no valid JRE found" message.


If you're trying to use the newtry-with-resources statement of Java 7 you should first of all look at the correct syntax here or doing some other web search. This link have some nice examples as well.

This being said, even if I'm not super familiar with Ubuntu 10.10, the following instruction should do the job: Installing Java 7 in Ubuntu.

Hope this helps!


I think "upgrading Xyz" is not a programming question but an administration question. Especially the Ubuntu companion site https://askubuntu.com/ is a better place for this question.

A quick look there turned up this may helpful post:

https://askubuntu.com/questions/89556/getting-java-working-again-in-10-10-or-force-newest-version-of-openjdk


your JDK and JRE are ok. Your code has an error. It should look like this:

try
{
    ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(defaultFile));
}
catch (IOException e)
{
    e.printStackTrace();
}

Need Your Help

Git not tracking a subdirectory

git git-submodules

I am pretty new to Git and it seems I always have some issue. I created a repo for my WordPress project but it isn't tracking the "Themes" folder. I think the issue is in the themes folder I pull my