Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Upgrading from JAVA 6 to 7(Problems with compiler)
Upgrading from JAVA 6 to 7 [message #825350] Tue, 20 March 2012 18:58 Go to next message
Joop Lanting is currently offline Joop LantingFriend
Messages: 8
Registered: July 2009
Junior Member
Hello,
I just upgraded from JAVA 6.30 to JAVA 7.3, but my ECLIPSE 3.8 sticks to JAVA 6 (1.6).
I have 20 projects running and I don't want to enter them from scratch again.
Should I throw away all .metadata and start all over again importing all of my projects
or is there a way to make ECLIPSE aware of JAVA 7 (1.7) for all projects?
;JOOP!
Re: Upgrading from JAVA 6 to 7 [message #825400 is a reply to message #825350] Tue, 20 March 2012 20:08 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
That depends on somewhat on whether you have project specific settings related to Java. If not, you control the JDK/JRE used in Window->Preferences->Java->Installed JREs. You can add additional JDK/JREs to your workspace and pick the default one.
Re: Upgrading from JAVA 6 to 7 [message #825830 is a reply to message #825400] Wed, 21 March 2012 10:04 Go to previous messageGo to next message
Joop Lanting is currently offline Joop LantingFriend
Messages: 8
Registered: July 2009
Junior Member
I uninstalled all JAVA versions from my laptop and then installed 7u3 (64-bit).
At least everything else worked.
To my dismay I got a bunch of errors; of course: rules were tightened once more.
But I also noted that, randomly, projects still were bound to a non-existing 1.6 library
while others had adapted to the (only) 1.7 library; b.t.w.: I never explicitly addressed any system library.
Did I do something wrong?
;JOOP!
Re: Upgrading from JAVA 6 to 7 [message #826246 is a reply to message #825830] Wed, 21 March 2012 21:20 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
The correct way to change the JDK/JRE used is to go to Window->Preferences->Java->Installed JREs as previously suggested. There is no reason to uninstall anything to switch.
Re: Upgrading from JAVA 6 to 7 [message #826519 is a reply to message #826246] Thu, 22 March 2012 06:55 Go to previous messageGo to next message
Joop Lanting is currently offline Joop LantingFriend
Messages: 8
Registered: July 2009
Junior Member
Well, so I did, but half of my projects kept referring the (non-existing) 1.6 library, so I had to change
their properties one by one.
A last question: I managed to solve 31 of the 35 errors ECLIPSE raised when 1.7 became the java version, mostly
by the quick fix.
However 4 (identical) errors remain, quick fix does not do anything here; example:

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

public class TestCase
{
static final String[] numbers = { "One", "Two", "Three"};

public static void main(String[] commandLine)
{
JList<String> myList = null;

myList = new JList<String>(numbers);
myList.setCellRenderer(getStripeRenderer(Color.RED, Color.BLUE)); // ERROR below ....
}
static ListCellRenderer getStripeRenderer(Color one, Color two)
{
return(new StripeRenderer(one, two));
}
}

Error message:
Type safety: The expression of type ListCellRenderer needs unchecked conversion to conform to ListCellRenderer<? super String>

I thought I knew a bit about generics but I don't have a clue what to change.
Thanks for your help.
;JOOP!
Re: Upgrading from JAVA 6 to 7 [message #826627 is a reply to message #826519] Thu, 22 March 2012 09:55 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Chage the getStripeRender declaration to 'ListCellRenderer<String> getStripeRenderer(Color one, Color two)'
Re: Upgrading from JAVA 6 to 7 [message #826695 is a reply to message #826627] Thu, 22 March 2012 11:46 Go to previous message
Joop Lanting is currently offline Joop LantingFriend
Messages: 8
Registered: July 2009
Junior Member
That worked.
All the other errors vanished by using a 'logical' choice from Quick Fix.
Thanks for answering.
;JOOP!
Previous Topic:Eclipse Error
Next Topic:How to listen to a compilation error as soon as it happens
Goto Forum:
  


Current Time: Thu Apr 18 23:41:24 GMT 2024

Powered by FUDForum. Page generated in 0.02418 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top