Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6800249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:56:47+00:00 2026-05-26T18:56:47+00:00

How can I view my jrxml file inside a JFrame ? I have the

  • 0

How can I view my jrxml file inside a JFrame?

I have the following java code:

package test;

import java.sql.Connection;
import java.sql.DriverManager;
import javax.swing.JFrame;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.swing.JRViewer;


public class Test extends JFrame {

    private Connection conn = null; // database connection

    public Test() {

        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            conn = DriverManager.getConnection(
                    "jdbc:oracle:thin:@localhost:1521:XE",
                    "test", "test");
            JasperReport report = JasperCompileManager.compileReport("report1.jrxml");
            JasperPrint print = JasperFillManager.fillReport(report, null, conn);
            JRViewer viewer = new JRViewer(print);
            viewer.setOpaque(true);
            viewer.setVisible(true);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }

        setSize(500, 600);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Test();
    }
}

However, when I try running it, I received the following error message:

log4j:WARN No appenders could be found for logger(net.sf.jasperreports.engine.xml.JRXmlDigesterFactory).

log4j:WARN Please initialize the log4j system properly.

My JFrame appears but but without the report I want to embed.

What do you think is my error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:56:48+00:00Added an answer on May 26, 2026 at 6:56 pm

    JRViewer is a JPanel, so instead of..

    viewer.setVisible(true);
    

    Put ..

    // Add the viewer to the frame
    add(viewer);
    

    As an aside:

    } catch (Exception e) {
    }
    

    Change that, to..

    } catch (Exception e) {
        e.printStackTrace();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you have an executable on Windows, you can view its import section with
I have successfully added admob ads to my android app and can view test
I have set nowrap so that I can view a file properly. So what
So I have used SQL Profiler before and I know how I can view
you can view full source code here dpaste.com/hold/167199 Error: delete() takes exactly 2 arguments
How can view the execution line used by netbean v6.8 to execute my java
I have a system whereby a user can view categories that they've subscribed to
I know the dotnetkicks.com system is open source so I can view the code
I have a tabled view in a while loop, where a user can view
Requirements : I have a table of several thousand questions. Users can view these

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.