File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble with Headless

 
Jose Guilherme Vanz
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody!

I use Hudson ( http://hudson-ci.org/ ) for compile, gerenate jars and execute my JUnits tests. Hudson runs in a Tomcat application server, and for execute JUnit test it trigger a Ant's target.
But I'm having problems when my JUnits tests tries open JFrames.
When the test tries open a JFrame using the parameter java.awt.headless=true is throw the following exception:

java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)

If I remove the parameter that I had passed before, the exception thrown is :

java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
Could not initialize class sun.awt.X11GraphicsEnvironment

I don't figure out what I'm doing wrong. Someone have a tip?
I was forgetting something, the application is running on Ubuntu Server.

Thank you
[]
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're trying to run a GUI application in a non-GUI environment.

You should demarcate your business logic from the GUI layer and test that.

As for gui testing, that's more of a selenium type thing, but not sure if it can test awt stuff.

WP
 
Jose Guilherme Vanz
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William P O'Sullivan wrote:You're trying to run a GUI application in a non-GUI environment.

You should demarcate your business logic from the GUI layer and test that.

As for gui testing, that's more of a selenium type thing, but not sure if it can test awt stuff.

WP


Hi, William
My business logic is not on GUI layer, I'm testing only my GUI layer. ;)

Thanks for tip!
[]'s
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic