Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Eclipse 3.1 SWT problem
Eclipse 3.1 SWT problem [message #461411] Thu, 22 September 2005 10:28 Go to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_00BC_01C5BF71.33556010
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

I have a problem creating a SWT application using Eclipse 3.1.
Under Eclipse 3.0 one could add the SWT Library to the project using:

Project->Properties->Java build path->Tab Libraries->Add =
Library->Standard Widget Toolkit (SWT)

Under 3.1 the SWT Library one cannot choose anymore!?!

My simple SWT example looks like this:

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;

public class TEST
{
public static void main(String[] args)
{
Shell shell =3D new Shell();
shell.setText("TEST");
}
}

After 'Run As' 'Java application' and/or on 'Run As' 'SWT Application' I =
get following error:

Exception in thread "main" java.lang.Error: Unresolved compilation =
problems:=20
Shell cannot be resolved to a type

If I move the cursor to the yellow light bulp with the white X on a red =
square (in line import org.eclipse.swt.SWT;)
Eclipse tells me:

'The import org.eclipse cannot be resolved'

Whats wrong?

Any help is appreciated!



------=_NextPart_000_00BC_01C5BF71.33556010
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P><FONT face=3DArial size=3D2>Hello,</FONT></P>
<P><FONT face=3DArial size=3D2>I have a problem creating a SWT =
application using=20
Eclipse 3.1.<BR>Under Eclipse 3.0 one could add&nbsp;the SWT Library to =
the=20
project using:<BR><BR>Project-&gt;Properties-&gt;Java build path-&gt;Tab =

Libraries-&gt;Add Library-&gt;Standard Widget Toolkit (SWT)<BR><BR>Under =
3.1 the=20
SWT Library one cannot choose anymore!?!<BR></FONT><FONT face=3DArial=20
size=3D2><BR>My simple SWT example looks like this:</P></FONT>
<P><FONT face=3DArial size=3D2>import org.eclipse.swt.SWT;<BR>import=20
org.eclipse.swt.widgets.*;</FONT></P>
<P><FONT face=3DArial size=3D2>public class TEST<BR></FONT><FONT =
face=3DArial=20
size=3D2>{<BR></FONT><FONT face=3DArial size=3D2>&nbsp; public static =
void=20
main(String[] args)<BR>&nbsp; </FONT><FONT face=3DArial=20
size=3D2>{<BR>&nbsp;&nbsp;&nbsp; </FONT><FONT face=3DArial =
size=3D2>Shell shell =3D new=20
Shell();<BR></FONT><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
shell.setText("TEST");<BR>&nbsp; </FONT><FONT face=3DArial=20
size=3D2>}<BR>}</FONT></P>
<P><FONT face=3DArial size=3D2>After 'Run As' 'Java application' and/or =
on 'Run As'=20
'SWT Application' I get following error:<BR><BR></FONT><FONT =
face=3DArial=20
size=3D2>Exception in thread "main" java.lang.Error: Unresolved =
compilation=20
problems: <BR></FONT><FONT face=3DArial size=3D2>Shell cannot be =
resolved to a=20
type</FONT></P>
<P><FONT face=3DArial size=3D2>If I move the cursor to the yellow light =
bulp with=20
the white X on a red square (in line import =
org.eclipse.swt.SWT;)<BR>Eclipse=20
tells me:<BR><BR></FONT><FONT face=3DArial size=3D2>'The import =
org.eclipse cannot=20
be resolved'<BR><BR>Whats wrong?<BR><BR>Any help is =
appreciated!</FONT></P>
<P><FONT face=3DArial size=3D2></FONT>&nbsp;</P></DIV></BODY></HTML>

------=_NextPart_000_00BC_01C5BF71.33556010--
Re: Eclipse 3.1 SWT problem [message #461413 is a reply to message #461411] Thu, 22 September 2005 10:45 Go to previous messageGo to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
Using 3.1 it's under the buildpath properties (right click on resource)
buildpath->configure build path...->Libraries Tab->Add Library...->SWT
now you just have to choose the location you want the swt to be located
at and voila everything should work.

Regards
Stefan

Mr. Burns wrote:
> Hello,
>
> I have a problem creating a SWT application using Eclipse 3.1.
> Under Eclipse 3.0 one could add the SWT Library to the project using:
>
> Project->Properties->Java build path->Tab Libraries->Add Library->Standard Widget Toolkit (SWT)
>
> Under 3.1 the SWT Library one cannot choose anymore!?!
>
> My simple SWT example looks like this:
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.*;
>
> public class TEST
> {
> public static void main(String[] args)
> {
> Shell shell = new Shell();
> shell.setText("TEST");
> }
> }
>
> After 'Run As' 'Java application' and/or on 'Run As' 'SWT Application' I get following error:
>
> Exception in thread "main" java.lang.Error: Unresolved compilation problems:
> Shell cannot be resolved to a type
>
> If I move the cursor to the yellow light bulp with the white X on a red square (in line import org.eclipse.swt.SWT;)
> Eclipse tells me:
>
> 'The import org.eclipse cannot be resolved'
>
> Whats wrong?
>
> Any help is appreciated!
>
>
>
Re: Eclipse 3.1 SWT problem [message #461414 is a reply to message #461413] Thu, 22 September 2005 10:58 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello Stafan,

thanks for your reply, but I cannot really follow what you wrote, I am a
newbee in 3.1!

So where I can find:

buildpath properties (right click on resource) <-- Which resource I should
click?

If I use menu Project->Properties->Java Build Path->Tab Libraries->Add
library, I get only following entries to choose:

JRE System Library
Plug-in Dependencies
User Library

No SWT!?! (As I wrote in my previous message)

So, please can you show me more detailed where I can find what you wrote?

Thanks again!



"Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im Newsbeitrag
news:dgu1u3$jq7$1@news.eclipse.org...
> Using 3.1 it's under the buildpath properties (right click on resource)
> buildpath->configure build path...->Libraries Tab->Add Library...->SWT now
> you just have to choose the location you want the swt to be located at and
> voila everything should work.
>
> Regards
> Stefan
>
> Mr. Burns wrote:
>> Hello,
>>
>> I have a problem creating a SWT application using Eclipse 3.1.
>> Under Eclipse 3.0 one could add the SWT Library to the project using:
>>
>> Project->Properties->Java build path->Tab Libraries->Add
>> Library->Standard Widget Toolkit (SWT)
>>
>> Under 3.1 the SWT Library one cannot choose anymore!?!
>>
>> My simple SWT example looks like this:
>>
>> import org.eclipse.swt.SWT;
>> import org.eclipse.swt.widgets.*;
>>
>> public class TEST
>> {
>> public static void main(String[] args)
>> {
>> Shell shell = new Shell();
>> shell.setText("TEST");
>> }
>> }
>>
>> After 'Run As' 'Java application' and/or on 'Run As' 'SWT Application' I
>> get following error:
>>
>> Exception in thread "main" java.lang.Error: Unresolved compilation
>> problems: Shell cannot be resolved to a type
>>
>> If I move the cursor to the yellow light bulp with the white X on a red
>> square (in line import org.eclipse.swt.SWT;)
>> Eclipse tells me:
>>
>> 'The import org.eclipse cannot be resolved'
>>
>> Whats wrong?
>>
>> Any help is appreciated!
>>
>>
Re: Eclipse 3.1 SWT problem [message #461417 is a reply to message #461414] Thu, 22 September 2005 11:42 Go to previous messageGo to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
Any resource in the project or the project folder itself in the package
explorer view.

Mr. Burns wrote:
> Hello Stafan,
>
> thanks for your reply, but I cannot really follow what you wrote, I am a
> newbee in 3.1!
>
> So where I can find:
>
> buildpath properties (right click on resource) <-- Which resource I should
> click?
>
> If I use menu Project->Properties->Java Build Path->Tab Libraries->Add
> library, I get only following entries to choose:
>
> JRE System Library
> Plug-in Dependencies
> User Library
>
> No SWT!?! (As I wrote in my previous message)
>
> So, please can you show me more detailed where I can find what you wrote?
>
> Thanks again!
>
>
>
> "Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im Newsbeitrag
> news:dgu1u3$jq7$1@news.eclipse.org...
>
>>Using 3.1 it's under the buildpath properties (right click on resource)
>>buildpath->configure build path...->Libraries Tab->Add Library...->SWT now
>>you just have to choose the location you want the swt to be located at and
>>voila everything should work.
>>
>>Regards
>>Stefan
>>
>>Mr. Burns wrote:
>>
>>>Hello,
>>>
>>>I have a problem creating a SWT application using Eclipse 3.1.
>>>Under Eclipse 3.0 one could add the SWT Library to the project using:
>>>
>>>Project->Properties->Java build path->Tab Libraries->Add
>>>Library->Standard Widget Toolkit (SWT)
>>>
>>>Under 3.1 the SWT Library one cannot choose anymore!?!
>>>
>>>My simple SWT example looks like this:
>>>
>>>import org.eclipse.swt.SWT;
>>>import org.eclipse.swt.widgets.*;
>>>
>>>public class TEST
>>>{
>>> public static void main(String[] args)
>>> {
>>> Shell shell = new Shell();
>>> shell.setText("TEST");
>>> }
>>>}
>>>
>>>After 'Run As' 'Java application' and/or on 'Run As' 'SWT Application' I
>>>get following error:
>>>
>>>Exception in thread "main" java.lang.Error: Unresolved compilation
>>>problems: Shell cannot be resolved to a type
>>>
>>>If I move the cursor to the yellow light bulp with the white X on a red
>>>square (in line import org.eclipse.swt.SWT;)
>>>Eclipse tells me:
>>>
>>>'The import org.eclipse cannot be resolved'
>>>
>>>Whats wrong?
>>>
>>>Any help is appreciated!
>>>
>>>
>
>
Re: Eclipse 3.1 SWT problem [message #461418 is a reply to message #461414] Thu, 22 September 2005 11:50 Go to previous messageGo to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
I just realized that It might be that the entry I am referring to is
added by the visual editor plugin. Don't have a clean installation of
eclipse around to check this.
In that case you would have to add a jar and find the plugins:
org.eclipse.swt.win32.win32.x86_3.1.0.jar (This is for Windows! The last
three entries are the os (win32) the windowsmanager(win32) and the
arch(x86). Just choose the jar that is appropriate for your os)
and org.eclipse.swt_3.1.0.jar to your project in order to have the swt
packages.

If you are doing a plugin project you can also use add plugin
dependencies to add the above two jars to your project.

Hope that helps and sorry for the confusion

Stefan

Mr. Burns wrote:
> Hello Stafan,
>
> thanks for your reply, but I cannot really follow what you wrote, I am a
> newbee in 3.1!
>
> So where I can find:
>
> buildpath properties (right click on resource) <-- Which resource I should
> click?
>
> If I use menu Project->Properties->Java Build Path->Tab Libraries->Add
> library, I get only following entries to choose:
>
> JRE System Library
> Plug-in Dependencies
> User Library
>
> No SWT!?! (As I wrote in my previous message)
>
> So, please can you show me more detailed where I can find what you wrote?
>
> Thanks again!
>
>
>
> "Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im Newsbeitrag
> news:dgu1u3$jq7$1@news.eclipse.org...
>
>>Using 3.1 it's under the buildpath properties (right click on resource)
>>buildpath->configure build path...->Libraries Tab->Add Library...->SWT now
>>you just have to choose the location you want the swt to be located at and
>>voila everything should work.
>>
>>Regards
>>Stefan
>>
>>Mr. Burns wrote:
>>
>>>Hello,
>>>
>>>I have a problem creating a SWT application using Eclipse 3.1.
>>>Under Eclipse 3.0 one could add the SWT Library to the project using:
>>>
>>>Project->Properties->Java build path->Tab Libraries->Add
>>>Library->Standard Widget Toolkit (SWT)
>>>
>>>Under 3.1 the SWT Library one cannot choose anymore!?!
>>>
>>>My simple SWT example looks like this:
>>>
>>>import org.eclipse.swt.SWT;
>>>import org.eclipse.swt.widgets.*;
>>>
>>>public class TEST
>>>{
>>> public static void main(String[] args)
>>> {
>>> Shell shell = new Shell();
>>> shell.setText("TEST");
>>> }
>>>}
>>>
>>>After 'Run As' 'Java application' and/or on 'Run As' 'SWT Application' I
>>>get following error:
>>>
>>>Exception in thread "main" java.lang.Error: Unresolved compilation
>>>problems: Shell cannot be resolved to a type
>>>
>>>If I move the cursor to the yellow light bulp with the white X on a red
>>>square (in line import org.eclipse.swt.SWT;)
>>>Eclipse tells me:
>>>
>>>'The import org.eclipse cannot be resolved'
>>>
>>>Whats wrong?
>>>
>>>Any help is appreciated!
>>>
>>>
>
>
Re: Eclipse 3.1 SWT problem [message #461419 is a reply to message #461418] Thu, 22 September 2005 11:56 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
if i remember correctly one has to download the swt separately (at least i
had to do that) and put into a place the project can integrate it (either
inside the project or as an external jar). be aware that the swt-jar is
platform dependent, so you have to chose the right arcive for your
development-platform (and maybe deployment-platform too).


> I just realized that It might be that the entry I am referring to is
> added by the visual editor plugin. Don't have a clean installation of
> eclipse around to check this.
> In that case you would have to add a jar and find the plugins:
> org.eclipse.swt.win32.win32.x86_3.1.0.jar (This is for Windows! The last
> three entries are the os (win32) the windowsmanager(win32) and the
> arch(x86). Just choose the jar that is appropriate for your os)
> and org.eclipse.swt_3.1.0.jar to your project in order to have the swt
> packages.
>
> If you are doing a plugin project you can also use add plugin
> dependencies to add the above two jars to your project.
>
> Hope that helps and sorry for the confusion
>
> Stefan
>
> Mr. Burns wrote:
>> Hello Stafan,
>> thanks for your reply, but I cannot really follow what you wrote, I am
>> a newbee in 3.1!
>> So where I can find:
>> buildpath properties (right click on resource) <-- Which resource I
>> should click?
>> If I use menu Project->Properties->Java Build Path->Tab Libraries->Add
>> library, I get only following entries to choose:
>> JRE System Library
>> Plug-in Dependencies
>> User Library
>> No SWT!?! (As I wrote in my previous message)
>> So, please can you show me more detailed where I can find what you
>> wrote?
>> Thanks again!
>> "Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im
>> Newsbeitrag news:dgu1u3$jq7$1@news.eclipse.org...
>>
>>> Using 3.1 it's under the buildpath properties (right click on
>>> resource) buildpath->configure build path...->Libraries Tab->Add
>>> Library...->SWT now you just have to choose the location you want the
>>> swt to be located at and voila everything should work.
>>>
>>> Regards
>>> Stefan
>>>
>>> Mr. Burns wrote:
>>>
>>>> Hello,
>>>>
>>>> I have a problem creating a SWT application using Eclipse 3.1.
>>>> Under Eclipse 3.0 one could add the SWT Library to the project using:
>>>>
>>>> Project->Properties->Java build path->Tab Libraries->Add
>>>> Library->Standard Widget Toolkit (SWT)
>>>>
>>>> Under 3.1 the SWT Library one cannot choose anymore!?!
>>>>
>>>> My simple SWT example looks like this:
>>>>
>>>> import org.eclipse.swt.SWT;
>>>> import org.eclipse.swt.widgets.*;
>>>>
>>>> public class TEST
>>>> {
>>>> public static void main(String[] args)
>>>> {
>>>> Shell shell = new Shell();
>>>> shell.setText("TEST");
>>>> }
>>>> }
>>>>
>>>> After 'Run As' 'Java application' and/or on 'Run As' 'SWT
>>>> Application' I get following error:
>>>>
>>>> Exception in thread "main" java.lang.Error: Unresolved compilation
>>>> problems: Shell cannot be resolved to a type
>>>>
>>>> If I move the cursor to the yellow light bulp with the white X on a
>>>> red square (in line import org.eclipse.swt.SWT;)
>>>> Eclipse tells me:
>>>>
>>>> 'The import org.eclipse cannot be resolved'
>>>>
>>>> Whats wrong?
>>>>
>>>> Any help is appreciated!
>>>>
>>>>
>>
Re: Eclipse 3.1 SWT problem [message #461421 is a reply to message #461418] Thu, 22 September 2005 12:03 Go to previous messageGo to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
The plugins are located in the plugins location of your eclipse
installation. This folder should also contain the correct version for
your platform.
It might be easier to download the visualeditor plugin since it brings
everything along to start a swt project.

Regards
Stefan

Stefan Langer wrote:
> I just realized that It might be that the entry I am referring to is
> added by the visual editor plugin. Don't have a clean installation of
> eclipse around to check this.
> In that case you would have to add a jar and find the plugins:
> org.eclipse.swt.win32.win32.x86_3.1.0.jar (This is for Windows! The last
> three entries are the os (win32) the windowsmanager(win32) and the
> arch(x86). Just choose the jar that is appropriate for your os)
> and org.eclipse.swt_3.1.0.jar to your project in order to have the swt
> packages.
>
> If you are doing a plugin project you can also use add plugin
> dependencies to add the above two jars to your project.
>
> Hope that helps and sorry for the confusion
>
> Stefan
>
> Mr. Burns wrote:
>
>> Hello Stafan,
>>
>> thanks for your reply, but I cannot really follow what you wrote, I am
>> a newbee in 3.1!
>>
>> So where I can find:
>>
>> buildpath properties (right click on resource) <-- Which resource I
>> should click?
>>
>> If I use menu Project->Properties->Java Build Path->Tab Libraries->Add
>> library, I get only following entries to choose:
>>
>> JRE System Library
>> Plug-in Dependencies
>> User Library
>>
>> No SWT!?! (As I wrote in my previous message)
>>
>> So, please can you show me more detailed where I can find what you wrote?
>>
>> Thanks again!
>>
>>
>>
>> "Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im Newsbeitrag
>> news:dgu1u3$jq7$1@news.eclipse.org...
>>
>>> Using 3.1 it's under the buildpath properties (right click on
>>> resource) buildpath->configure build path...->Libraries Tab->Add
>>> Library...->SWT now you just have to choose the location you want the
>>> swt to be located at and voila everything should work.
>>>
>>> Regards
>>> Stefan
>>>
>>> Mr. Burns wrote:
>>>
>>>> Hello,
>>>>
>>>> I have a problem creating a SWT application using Eclipse 3.1.
>>>> Under Eclipse 3.0 one could add the SWT Library to the project using:
>>>>
>>>> Project->Properties->Java build path->Tab Libraries->Add
>>>> Library->Standard Widget Toolkit (SWT)
>>>>
>>>> Under 3.1 the SWT Library one cannot choose anymore!?!
>>>>
>>>> My simple SWT example looks like this:
>>>>
>>>> import org.eclipse.swt.SWT;
>>>> import org.eclipse.swt.widgets.*;
>>>>
>>>> public class TEST
>>>> {
>>>> public static void main(String[] args)
>>>> {
>>>> Shell shell = new Shell();
>>>> shell.setText("TEST");
>>>> }
>>>> }
>>>>
>>>> After 'Run As' 'Java application' and/or on 'Run As' 'SWT
>>>> Application' I get following error:
>>>>
>>>> Exception in thread "main" java.lang.Error: Unresolved compilation
>>>> problems: Shell cannot be resolved to a type
>>>>
>>>> If I move the cursor to the yellow light bulp with the white X on a
>>>> red square (in line import org.eclipse.swt.SWT;)
>>>> Eclipse tells me:
>>>>
>>>> 'The import org.eclipse cannot be resolved'
>>>>
>>>> Whats wrong?
>>>>
>>>> Any help is appreciated!
>>>>
>>>>
>>
>>
Re: Eclipse 3.1 SWT problem [message #461422 is a reply to message #461418] Thu, 22 September 2005 12:11 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
Hello Stefan,

I added now the two JARs as you mentioned, the compiler errors dissappear
now but I got another problem.
If I run the project I get the error message:

Could not find the main class. Program will exit.

Under the 'Run configuration' of the project the 'Main class' TEST is
availalable!?!
Do I have to add VM arguments also? Its empty!
Under Eclipse 3.0 I had
'-Djava.library.path=C:\wampp2\eclipse\plugins\org.eclipse.s wt.win32_3.0.2\os\win32\x86'

But under 3.1 the native libraries (the SWTxxx.dll) should be within the
JARs I added already, or am I wrong?

Thanks for further support!


"Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im Newsbeitrag
news:dgu5o4$p5a$1@news.eclipse.org...
>I just realized that It might be that the entry I am referring to is added
>by the visual editor plugin. Don't have a clean installation of eclipse
>around to check this.
> In that case you would have to add a jar and find the plugins:
> org.eclipse.swt.win32.win32.x86_3.1.0.jar (This is for Windows! The last
> three entries are the os (win32) the windowsmanager(win32) and the
> arch(x86). Just choose the jar that is appropriate for your os)
> and org.eclipse.swt_3.1.0.jar to your project in order to have the swt
> packages.
>
> If you are doing a plugin project you can also use add plugin dependencies
> to add the above two jars to your project.
>
> Hope that helps and sorry for the confusion
>
> Stefan
>
> Mr. Burns wrote:
>> Hello Stafan,
>>
>> thanks for your reply, but I cannot really follow what you wrote, I am a
>> newbee in 3.1!
>>
>> So where I can find:
>>
>> buildpath properties (right click on resource) <-- Which resource I
>> should click?
>>
>> If I use menu Project->Properties->Java Build Path->Tab Libraries->Add
>> library, I get only following entries to choose:
>>
>> JRE System Library
>> Plug-in Dependencies
>> User Library
>>
>> No SWT!?! (As I wrote in my previous message)
>>
>> So, please can you show me more detailed where I can find what you wrote?
>>
>> Thanks again!
>>
>>
>>
>> "Stefan Langer" <eclipse@bettsockentraeger.de> schrieb im Newsbeitrag
>> news:dgu1u3$jq7$1@news.eclipse.org...
>>
>>>Using 3.1 it's under the buildpath properties (right click on resource)
>>>buildpath->configure build path...->Libraries Tab->Add Library...->SWT
>>>now you just have to choose the location you want the swt to be located
>>>at and voila everything should work.
>>>
>>>Regards
>>>Stefan
>>>
>>>Mr. Burns wrote:
>>>
>>>>Hello,
>>>>
>>>>I have a problem creating a SWT application using Eclipse 3.1.
>>>>Under Eclipse 3.0 one could add the SWT Library to the project using:
>>>>
>>>>Project->Properties->Java build path->Tab Libraries->Add
>>>>Library->Standard Widget Toolkit (SWT)
>>>>
>>>>Under 3.1 the SWT Library one cannot choose anymore!?!
>>>>
>>>>My simple SWT example looks like this:
>>>>
>>>>import org.eclipse.swt.SWT;
>>>>import org.eclipse.swt.widgets.*;
>>>>
>>>>public class TEST
>>>>{
>>>> public static void main(String[] args)
>>>> {
>>>> Shell shell = new Shell();
>>>> shell.setText("TEST");
>>>> }
>>>>}
>>>>
>>>>After 'Run As' 'Java application' and/or on 'Run As' 'SWT Application' I
>>>>get following error:
>>>>
>>>>Exception in thread "main" java.lang.Error: Unresolved compilation
>>>>problems: Shell cannot be resolved to a type
>>>>
>>>>If I move the cursor to the yellow light bulp with the white X on a red
>>>>square (in line import org.eclipse.swt.SWT;)
>>>>Eclipse tells me:
>>>>
>>>>'The import org.eclipse cannot be resolved'
>>>>
>>>>Whats wrong?
>>>>
>>>>Any help is appreciated!
>>>>
>>>>
>>
Sorry wrong error message posted! [message #461423 is a reply to message #461422] Thu, 22 September 2005 12:42 Go to previous messageGo to next message
mr. burns is currently offline mr. burnsFriend
Messages: 402
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C5BF83.CD592680
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

in my previous post I posted a wrong error message:

> Could not find the main class. Program will exit. <-- WRONG!!!

but after running it appears following error message:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no =
swt-win32-3138 in java.library.path <-- Correct one!!!
So, what I have to add under the VM arguments of the 'run =
configuration'?

The directory =
....\eclipse\plugins\org.eclipse.swt.win32_3.X.X\os\win32\x8 6 no more =
exists under eclipse 3.1, because everything is inside the two JARs. So =
what I should enter instead?

Thanks for further support!
------=_NextPart_000_000B_01C5BF83.CD592680
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>in my previous post I posted a wrong =
error=20
message:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&gt; Could not find the main class. =
Program will=20
exit. &lt;-- WRONG!!!<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>but after running it appears following =
error=20
message:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>Exception in thread "main"=20
java.lang.UnsatisfiedLinkError: no swt-win32-3138 in java.library.path =
&lt;--=20
Correct one!!!</FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2>So, what I have to add under the VM =
arguments of the=20
'run configuration'?<BR></FONT><FONT face=3DArial size=3D2><BR>The =
directory=20
....\eclipse\plugins\org.eclipse.swt.win32_3.X.X\os\win32\x8 6 no more =
exists=20
under eclipse 3.1, because everything is inside the two JARs. So what I =
should=20
enter instead?</FONT></P><FONT face=3DArial size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for further support!</FONT><FONT =
face=3DArial=20
size=3D2></FONT></DIV></BODY></HTML>

------=_NextPart_000_000B_01C5BF83.CD592680--
Re: Sorry wrong error message posted! [message #461427 is a reply to message #461423] Thu, 22 September 2005 13:30 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

To get an SWT app to run in 3.1 you can follow the help path from SWT
Example Launcher, but there is a quick way to get started.

1. create you java project.
2. Configure the build path, go to Libraries, and add a variable
3. Click on ECLIPSE_HOME and hit the extend button
4. go into plugins until you find the 2 SWT jars you need
5. now you can create you class in your project, for example:
package com.test;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class SwtExample {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("TEST");
shell.open();
while (!shell.isDisposed()) {
if (display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}

6. Create an SWT Application launcher for the class, and Run

It worked fine in 3.1

Later,
PW


Re: Eclipse 3.1 SWT problem [message #461428 is a reply to message #461422] Thu, 22 September 2005 13:44 Go to previous messageGo to next message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
There is a tutorial on the SWT page about how to set up Eclipse for
developing SWT applications. See:

http://www.eclipse.org/swt/eclipse.php

> Under the 'Run configuration' of the project the 'Main class' TEST is
> availalable!?!
> Do I have to add VM arguments also? Its empty!
> Under Eclipse 3.0 I had
> '-Djava.library.path=C:\wampp2\eclipse\plugins\org.eclipse.s wt.win32_3.0.2\os\win32\x86'
>
> But under 3.1 the native libraries (the SWTxxx.dll) should be within the
> JARs I added already, or am I wrong?

The .jar files in the Eclipse directory are Eclipse plugins. Eclipse
extracts the .DLLs at runtime and puts them on its library path.
However, for an SWT application, you'll need to either extract the .DLLs
yourself (ouch!) or use the SWT standalone download from the SWT
homepage (nice!). You can also use "Run As > SWT Application". This
will extract the .DLLs for you and automatically add them to the library
path of the run configuration.

Sorry for the confusion,
-Billy
Re: Eclipse 3.1 SWT problem [message #461434 is a reply to message #461414] Thu, 22 September 2005 16:08 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

You need to install the VE project to get the SWT library. It is made
available through VE. You can get VE through the update manager (VE is
the Visual Editor), make sure you select "Add Required...". The update
manager will get you version 1.1.0, but there is a 1.1.0.1 that fixes
many bugs in 1.1.0. You can get that by doing a scan for updates after
installing 1.1.0


--
Thanks,
Rich Kulp
Previous Topic:Eclipse 3.1 JavaDoc problem
Next Topic:What are the units for the Point class?
Goto Forum:
  


Current Time: Tue Apr 23 13:51:01 GMT 2024

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

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

Back to the top