Problem even with the Hello World

T

thanat0s

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/tutorials/hello-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:826)
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:208)
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.layout.gle1.GraphicalLayoutEditor.computeLayout(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor.recomputeLayout(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor.onConfigurationChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.onDeviceConfigChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.onDeviceChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.access$2(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite$2.widgetSelected(Unknown
Source)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
 
S

Stefan Ram

thanat0s said:
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.
 
L

Lew

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.
 
A

Arne Vajhøj

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
 
T

Tom Anderson

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/tutorials/hello-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
 
L

Lew

Stefan said:
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.

Peter said:
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.
 
A

Arne Vajhøj

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
 
T

Tom Anderson

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


Android is a Linux kernel.

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

tom
 
A

Arne Vajhøj

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

I don't know if it is relevant or not.

But note that both the topics:
- whether Android phone is real computer
- whether Android is a Unix platform
was raised by you.

Arne
 
T

Tom Anderson

I don't know if it is relevant or not.

But note that both the topics:
- whether Android phone is real computer
- whether Android is a Unix platform
was raised by you.

True. But the scare quotes around 'real' indicate that i'm not using it
for its literal meaning, and so not suggesting that Android machines are
not actually computers, and from a GUI point of view, which is what was
under discussion, Android is *not* a unix platform. Or do you reckon
there's an X server in there somewhere?

tom
 
L

Lew

Tom said:
True. But the scare quotes around 'real' indicate that i'm not using it
for its literal meaning, and so not suggesting that Android machines are
not actually computers, and from a GUI point of view, which is what was
under discussion, Android is *not* a unix platform. Or do you reckon
there's an X server in there somewhere?

If you meant "X" you should have said "X" and not "UNIX".

X Windows and UNIX (or UNIX-like) are orthogonal. Or do you reckon that when
I run X on MS Windows that the latter turns into UNIX?
 
T

Tom Anderson

If you meant "X" you should have said "X" and not "UNIX".

No. I don't believe that would have been as helpful to the OP (if my
comment was helpful at all), who seems to have a problem related to some
bit of code running the wrong platform's AWT toolkit - if he hadn't
realised that himself, simply saying 'X' wouldn't have helped.
X Windows and UNIX (or UNIX-like) are orthogonal.

No. X is the unix window system.
Or do you reckon that when I run X on MS Windows that the latter turns
into UNIX?

No. But you are running a port of a unix technology to Windows. You can
run bash on on Windows - does that mean bash is not a unix program?

tom
 
L

Lew

Tom said:
No. But you are running a port of a unix technology to Windows. You can
run bash on on Windows - does that mean bash is not a unix program?

Yes, that is exactly what it means. "bash" is a program. Whether it's a UNIX
program or MS Windows program or a VMS program depends entirely on the OS on
which it's running.
 
J

Joshua Cranmer

No. X is the unix window system.

Actually, I believe X is more a protocol than a window system. Your
computer has an X server (or several), and programs (X clients) can
communicate with it. So a Windows program can just as easily be an X
client as can a Linux, Solaris, Mac, VMS, etc. program. Similarly, X
servers pretty much exist for major systems (that includes Windows: see
Xming et al.). God^H^H^HWikipedia claims that is originally designed for
thin clients.
 
A

Arne Vajhøj

True. But the scare quotes around 'real' indicate that i'm not using it
for its literal meaning, and so not suggesting that Android machines are
not actually computers,

So what meaning of real were you using?
and from a GUI point of view, which is what was
under discussion, Android is *not* a unix platform.

It is a Linux platform and since Linux is not Unix certified
then it is not a true Unix, but it is sure Unix like.
Or do you reckon
there's an X server in there somewhere?

Whether there is an X server or not should not have much to
do with whether it is Unix or not.

There are plenty of Unixes that run without X.

Arne

PS: Android does not come with X, but smart people have made
it run on Android.
 
A

Arne Vajhøj

No. X is the unix window system.

It is not.

X is the windowing system on most Unix'es, some Unix-like OS's
like Linux and some non-Unix OS's like OpenVMS.

But on the Unix used most on desktop systems it is an optional
component (MacOS X).

X was created to be OS independent.
No. But you are running a port of a unix technology to Windows.

No.

The intention of X is to be platform independent. It is not Unix
technology. It is standard technology.
You can
run bash on on Windows - does that mean bash is not a unix program?

Most will consider bash a Unix program, but people that use bash on
non Unix (incl. Unix like) platform does it to emulate Unix environment.
Either because they prefer it or need it for compatibility.

X was implemented on non-Unix platforms at the same time
as on Unix platforms and are native GUI on some non-Unix
platforms.

Arne
 
T

thanat0s

Hi all, has someone event read fully my question...

i'm try coding for android platform, i'm on a linux workstation last
ubuntu. And i got the problem in eclipse ide.. dealing with my X on the PC.

Is it more clear ?

I probably choose the wrong channe ;)
 
R

RedGrittyBrick


Please don't top-post, it is annoying to many people. If you don't know
what top-posting is, please read this:
has someone event read fully my question...

Yes, someone has even read your question in full.

I guess English isn't your first language so we should forgive the
errors that make it hard to understand what you have written. However,
effort spent writing clearly should gain you a more informative response.

Having a zero in your pseudonym doesn't make me hopeful that you will
even read all the replies conscientiously.
i'm try coding for android platform, i'm on a linux workstation last
ubuntu. And i got the problem in eclipse ide.. dealing with my X on the PC.

Is it more clear ?

No - what is your "X" on your PC? Is it relevant?
I probably choose the wrong channe ;)

This isn't a channel, this isn't IRC. But yes, there are probably
support forums for Android developers that have more Android related
traffic than the comp.lang.java.programmer newsgroup.
<http://developer.android.com/resources/community-groups.html>

On the other hand, I know a bit about Java, I own an Android phone, I
may write an Android App and I read this newsgroup. I wouldn't be
surprised to see Android related Java programming discussion here, nor
would I object.

Problems with the Eclipse IDE specifically, or with the Android plugins
for Eclipse, are probably off-topic here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top