Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Problem even with the Hello World

Reply
Thread Tools

Problem even with the Hello World

 
 
thanat0s
Guest
Posts: n/a
 
      06-05-2010
Hi all,

To be clear, i'm a brand new newbies in java programming, i just try to
follow android coding tutorials. and i got already a problem !

I follow this tuto :
http://developer.android.com/guide/t...llo-world.html

And everything run fine, but since i try to use the XML layout problems
begins. I can't run the application, i c'ant event edit graphicaly the
layout\main.xml i got

It seem i miss a library but how, where ?
hope someone could help me.



java.lang.NoClassDefFoundError: Could not initialize class
sun.awt.X11.XToolkit
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.awt.Toolkit$2.run(Toolkit.java:834)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:82 6)
at android.graphics.Paint.updateFontObject(Paint.java :264)
at android.graphics.Paint.initFont(Paint.java:241)
at android.graphics.Paint.<init>(Paint.java:213)
at android.graphics.Paint.<init>(Paint.java:20
at android.view.ViewGroup.<init>(ViewGroup.java:276)
at android.widget.FrameLayout.<init>(FrameLayout.java :75)
at com.android.layoutlib.bridge.Bridge.computeLayout( Bridge.java:394)
at
com.android.ide.eclipse.adt.internal.editors.layou t.gle1.GraphicalLayoutEditor.computeLayout(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layou t.gle1.GraphicalLayoutEditor.recomputeLayout(Unkno wn
Source)
at
com.android.ide.eclipse.adt.internal.editors.layou t.gle1.GraphicalLayoutEditor.onConfigurationChange (Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite.onDeviceCon figChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite.onDeviceCha nge(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite.access$2(Un known
Source)
at
com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite$2.widgetSel ected(Unknown
Source)
at
org.eclipse.swt.widgets.TypedListener.handleEvent( TypedListener.java:22
at org.eclipse.swt.widgets.EventTable.sendEvent(Event Table.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1176)
at org.eclipse.swt.widgets.Display.runDeferredEvents( Display.java:3493)
at org.eclipse.swt.widgets.Display.readAndDispatch(Di splay.java:3112)
at org.eclipse.ui.internal.Workbench.runEventLoop(Wor kbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench. java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workben ch.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench. java:500)
at
org.eclipse.core.databinding.observable.Realm.runW ithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWork bench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Pl atformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplica tion.start(IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle. run(EclipseAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.runApplication(EclipseAppLauncher.java: 110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:36
at
org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework( Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.ja va:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:13 11)

 
Reply With Quote
 
 
 
 
Stefan Ram
Guest
Posts: n/a
 
      06-05-2010
thanat0s <(E-Mail Removed)> writes:
¯¯¯¯¯??
>i try to use the XML layout


A »hello world« program usually does not deal with XML layout.

public class Main
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( "hello world" ); }}

(not tested.)

It saved as »Main.java«, compiled with

javac Main.java

and run¹ with

java Main

when using the Java SE SDK from Oracle.

 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      06-05-2010
On 06/05/2010 08:29 AM, Stefan Ram wrote:
> public class Main
> { public static void main( final java.lang.String[] args )
> { java.lang.System.out.println( "hello world" ); }}


I'm curious, Stefan, why you flout the code conventions and why you bother
specifying "java.lang." packages.

--
Lew
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-05-2010
On 05-06-2010 08:29, Stefan Ram wrote:
> thanat0s<(E-Mail Removed)> writes:
>> i try to use the XML layout

>
> A »hello world« program usually does not deal with XML layout.


Not as a Java SE console app.

But maybe an Android app as the poster are trying to write
do use it.

Arne
 
Reply With Quote
 
Arved Sandstrom
Guest
Posts: n/a
 
      06-05-2010
Stefan Ram wrote:
> thanat0s <(E-Mail Removed)> writes:
> ¯¯¯¯¯??
>> i try to use the XML layout

>
> A »hello world« program usually does not deal with XML layout.
>

[ SNIP ]

Look at Android developer resources and see what they suggest as a Hello
World: http://developer.android.com/resourc...llo-world.html

AHS

--
The only way to learn a new programming language is by writing programs
in it.
--Dennis Ritchie
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      06-05-2010
On Sat, 5 Jun 2010, thanat0s wrote:

> To be clear, i'm a brand new newbies in java programming, i just try to
> follow android coding tutorials. and i got already a problem !
>
> I follow this tuto :
> http://developer.android.com/guide/t...llo-world.html
>
> And everything run fine, but since i try to use the XML layout problems
> begins. I can't run the application, i c'ant event edit graphicaly the
> layout\main.xml i got
>
> It seem i miss a library but how, where ? hope someone could help me.


Try an android developer forum. This group mostly deals with programming
on 'real' computers.

That said, this problem looks like something is trying to use
unix-specific AWT operations; are you using a unix platform? Why would
there be AWT going on inside Eclipse, which uses SWT? This looks like a
configuration problem. Are you using a supported platform for whatever
this editor is?

tom

> java.lang.NoClassDefFoundError: Could not initialize class
> sun.awt.X11.XToolkit
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:169)
> at java.awt.Toolkit$2.run(Toolkit.java:834)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:82 6)
> at android.graphics.Paint.updateFontObject(Paint.java :264)
> at android.graphics.Paint.initFont(Paint.java:241)
> at android.graphics.Paint.<init>(Paint.java:213)
> at android.graphics.Paint.<init>(Paint.java:20
> at android.view.ViewGroup.<init>(ViewGroup.java:276)
> at android.widget.FrameLayout.<init>(FrameLayout.java :75)
> at com.android.layoutlib.bridge.Bridge.computeLayout( Bridge.java:394)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.gle1.GraphicalLayoutEditor.computeLayout(Unknown
> Source)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.gle1.GraphicalLayoutEditor.recomputeLayout(Unkno wn
> Source)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.gle1.GraphicalLayoutEditor.onConfigurationChange (Unknown
> Source)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite.onDeviceCon figChange(Unknown
> Source)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite.onDeviceCha nge(Unknown
> Source)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite.access$2(Un known
> Source)
> at
> com.android.ide.eclipse.adt.internal.editors.layou t.configuration.ConfigurationComposite$2.widgetSel ected(Unknown
> Source)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent( TypedListener.java:22
> at org.eclipse.swt.widgets.EventTable.sendEvent(Event Table.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.ja va:1176)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents( Display.java:3493)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Di splay.java:3112)
> at
> org.eclipse.ui.internal.Workbench.runEventLoop(Wor kbench.java:2405)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench. java:2369)
> at org.eclipse.ui.internal.Workbench.access$4(Workben ch.java:2221)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench. java:500)
> at
> org.eclipse.core.databinding.observable.Realm.runW ithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWork bench(Workbench.java:493)
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(Pl atformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplica tion.start(IDEApplication.java:113)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle. run(EclipseAppHandle.java:194)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.runApplication(EclipseAppLauncher.java: 110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseA ppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:36
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.ru n(EclipseStarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.equinox.launcher.Main.invokeFramework( Main.java:559)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.ja va:514)
> at org.eclipse.equinox.launcher.Main.run(Main.java:13 11)
>
>


--
The trouble with eating German cuisine is that 3 days later, you are
hungry again! -- Graham, uk.food+drink.misc
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      06-05-2010
Stefan Ram wrote:
>>> public class Main
>>> { public static void main( final java.lang.String[] args )
>>> { java.lang.System.out.println( "hello world" ); }}


Lew wrote:
>> I'm curious, Stefan, why you flout the code conventions and why you
>> bother specifying "java.lang." packages.


Peter Duniho wrote:
> Maybe for the same reasons that you insist on flogging the code
> conventions and package declarations?
>
> Seriously, get over it. Not everyone is writing code the way you think
> it has to be written. If it really mattered that much, the compiler
> would require the code to be formatted in a specific way.


Hey, I was just wondering. Reasons interest me. So sue me.

Sheesh.

Stefan, regardless of what some people might think, I'm not criticizing your
usage, I truly am just asking after the reasoning behind it.

--
Lew
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      06-05-2010
On Sat, 05 Jun 2010 10:23:58 +0200, thanat0s <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

>java.lang.NoClassDefFoundErro


this is one of the toughest errors to track down since it has so many
possible causes. You have added the complication of Android. You
might start learning desktop Java first then once you have that under
your belt, add the Android complication.

See http://mindprod.com/jgloss/helloworld.html
http://mindprod.com/jgloss/gettingstarted.html
http://mindprod.com/jgloss/runerrorm...SDEFFOUNDERROR
--
Roedy Green Canadian Mind Products
http://mindprod.com

Have you ever noticed that any computer search in the movies, is always linear, with, for example, candidate fingerprints flashing up on the screen one after another? The public is still under the delusion that electronic files are microscopic filing cabinets made out of tiny wires or magnetic patches inside the computer. Most lay people are surprised that it is easy for a computer to file things simultaneously by a dozen different schemes, and that they can have any report printed in any number of different sorted orders. With physical files, they are limited to one ordering/access.
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      06-05-2010
On 05-06-2010 12:12, Tom Anderson wrote:
> On Sat, 5 Jun 2010, thanat0s wrote:
>> To be clear, i'm a brand new newbies in java programming, i just try
>> to follow android coding tutorials. and i got already a problem !
>>
>> I follow this tuto :
>> http://developer.android.com/guide/t...llo-world.html
>>
>> And everything run fine, but since i try to use the XML layout
>> problems begins. I can't run the application, i c'ant event edit
>> graphicaly the layout\main.xml i got
>>
>> It seem i miss a library but how, where ? hope someone could help me.

>
> Try an android developer forum. This group mostly deals with programming
> on 'real' computers.


Java on a 1 GHz CPU with 512 MB RAM was a real computer just a few
years ago.

> That said, this problem looks like something is trying to use
> unix-specific AWT operations; are you using a unix platform? Why would
> there be AWT going on inside Eclipse, which uses SWT? This looks like a
> configuration problem. Are you using a supported platform for whatever
> this editor is?


Android is a Linux kernel.

Arne
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      06-05-2010
On Sat, 5 Jun 2010, Arne Vajh?j wrote:

> On 05-06-2010 12:12, Tom Anderson wrote:
>> On Sat, 5 Jun 2010, thanat0s wrote:
>>> To be clear, i'm a brand new newbies in java programming, i just try
>>> to follow android coding tutorials. and i got already a problem !
>>>
>>> I follow this tuto :
>>> http://developer.android.com/guide/t...llo-world.html
>>>
>>> And everything run fine, but since i try to use the XML layout
>>> problems begins. I can't run the application, i c'ant event edit
>>> graphicaly the layout\main.xml i got
>>>
>>> It seem i miss a library but how, where ? hope someone could help me.

>>
>> Try an android developer forum. This group mostly deals with programming
>> on 'real' computers.

>
> Java on a 1 GHz CPU with 512 MB RAM was a real computer just a few
> years ago.
>
>> That said, this problem looks like something is trying to use
>> unix-specific AWT operations; are you using a unix platform? Why would
>> there be AWT going on inside Eclipse, which uses SWT? This looks like a
>> configuration problem. Are you using a supported platform for whatever
>> this editor is?

>
> Android is a Linux kernel.


The APIs and deployment model are different. Your observations are
interesting but irrelevant.

tom

--
pikachu in front if a tv shouting at the monkey jumping around the
screen-within-a-screen
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
regular expression to parse {"hello", "hello world","1hello-2*hello"} Roy Java 6 01-07-2008 08:06 PM
to print in the reverse order, ("Hello World" -> "World Hello") vijay C Programming 8 04-26-2005 02:11 AM
The world's shortest 'Hello World!' program: a proposal Larry Perl Misc 27 01-25-2005 07:53 PM



Advertisments