Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Desktop / X-Windows
Reload this Page Problem in Creating image in Linux Run Level-3
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Desktop / X-Windows Anything X. Gnome, KDE, remote desktop's, XGames etc.

Reply
 
Thread Tools Display Modes
Old 03-26-2004   #1 (permalink)
ksiddiqui
Just Joined!
 
Join Date: Mar 2004
Posts: 1
Problem in Creating image in Linux Run Level-3

Hi all,

I m using RedHat Linux 9 as OS, i use the following code to creat a WBMP image,
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.awt.font.*;
import javax.imageio.*;
import java.io.*;
import javax.media.jai.*;

public class Createlogo
{
Createlogo ()
{
try
{
Font cachedFont = new Font ( "Arial", 1, 1 );
cachedFont = cachedFont.deriveFont ( ( float ) 9 );
BufferedImage im = new BufferedImage ( 72, 14, BufferedImage.TYPE_BYTE_BINARY );
Graphics2D graphics = im.createGraphics ();
graphics.setBackground ( new Color ( 0xff, 0xff, 0xff ) );
graphics.setColor ( new Color ( 0, 0, 0 ) );
graphics.clearRect ( 0, 0, 72, 14 );
graphics.setFont ( cachedFont );
FontRenderContext frc = graphics.getFontRenderContext ();
TextLayout layout = new TextLayout ( "Java", cachedFont, frc );
Rectangle2D bounds = layout.getBounds ();
FontMetrics fm = graphics.getFontMetrics ();

layout.draw ( graphics, ( float ) Math.floor ( ( 72 - bounds.getMaxX () ) / 2 ), fm.getMaxAscent () );

JAI.create ( "filestore", im, "/home/oracle/Java/img.wbmp", "wbmp" );
}
catch(Exception e)
{
System.out.println(e);
}
}

public static void main(String[] args)
{
Createlogo cl = new Createlogo();
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

It is working very well in Level-5 and creating image but when i change run level to 3, and restart the system in run level 3, the following exception appears on execution of -> java Createlogo

Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

Please tell me how i can sucessfully create image using run level 3.

Thanks in advance...
ksiddiqui is offline   Reply With Quote
Old 03-27-2004   #2 (permalink)
lordnothing
Linux Engineer
 
Join Date: Sep 2003
Location: Knoxhell, TN
Posts: 1,078
Send a message via MSN to lordnothing
the problem is this: that program is dependent upon X... you have to be running an X server for it to work... i think that is how it works with most graphical programs unless you have it set up to work in framebuffer mode.... once in runlevel 3, if you type 'startx' (w/o quotes) at the prompt, it will start X again without changing you current runlevel... you can then do what you have to in X and then shut X down and go back to a prompt instead of a DM....
__________________
Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr
lordnothing is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 07:04 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.0.0