Hello!
1st let me apologize if I have duplicated a post. I am a newbie to DaniWeb (and to Java and HTML) and have searched your forum for a few hours now and not found and answer to my problem. I was hoping someone could help.

I have a simple Java program that reads a MS Access Database and displays selected fields from each record on the screen until the end-of-file. It works wonderful in Eclipse!

I then have a HTML file which implements the java .class file created "TechServices.class".

==============================================================================================================
Here is the code for the Java program:

import java.sql.*;
import java.applet.*;
import java.awt.*;


public class TechServices extends Applet { public static void main(String[] args) {
    try {          
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");          
        String accessFileName = "C:/TEST/Tech ServicesCOPY";          
        String connURL="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+accessFileName+".accdb;";          
        Connection con = DriverManager.getConnection(connURL, "","");          
        Statement stmt = con.createStatement();          
        stmt.execute("select * from tblProblemInformation"); 
        // execute query in table student 
        ResultSet rs = stmt.getResultSet(); 
        // get any Result that came from our query  
        if (rs != null)  while ( rs.next() ){
            String pdate = rs.getString("dtmProblemDate");
            if (pdate != null) pdate = pdate.substring(0,10); // strip off time of 0's
            String cdate = rs.getString("dtmClosedDate");
            if (cdate != null) cdate = cdate.substring(0,10); // strip off time of 0's
            System.out.println("#" + rs.getString("strProblemNumber") 
                                + " Problem-Date: " + pdate
                                + " Close-Date: " + cdate
                                + " AssignedTo: "+rs.getString("strAssignedTo"));
//          System.out.println("0---------1---------2---------3---------4---------5---------6---------7---------8");
        }   
        stmt.close();             
        con.close();         
    }         
    catch (Exception err) {             
        System.out.println("ERROR: " + err);         
    } 
} 
}

==============================================================================================================

Here is the code for the HTML:

<html>
<head>
</head>
<body bgcolor="pink">
<applet code="TechServices.class" width=1000 height=500>
</applet>
</body>
</html>

==============================================================================================================

Can anyone tell me why this produces nothing but a blank screen when I run the HTML file?

Thanks in advance for your attention to this matter!

Look in the browser's java console for any error messages.
You should call the printStackTrace() method in the catch block to get better error messages.

Edited 4 Years Ago by NormR1

Thanks for the fast response!

I'm not sure how to use my Java Console yet. I have went thru lots of tutorials so far, but none have touched on that.

I tried putting the printStackTrace() method, and it forced me to actually write a method, which I did ... which simply statet "System.out.println("ERROR!!!");".

This this did fix the problem, nor did I get the message "ERROR!!!".

Any other ideas? I'm at a total loss. I will start studying the Java Console immediately!

ThanX in advance!

Printing out the full text of error messages helps you find the problem, It will not fix the problem.

You must find the browser's java console to see if it has any error messages. Go to th control panel, open the Java icon and make sure the java console is set to be displayed.

Looking at your code I can't see code that would display anything on the screen/in the browser window. You just print things to System.out, which is the java console.
To display things on the screen/in the browser window you will need to useSwing components such as JLabel or JTextArea

I clicked on "Show Console" and exited Control Panel, and refreshed my webpage and the console did not pop up. Shouldn't it have?

The only time I have seen it is when I had an error in my Java code that HTML did not like and I had a red mark ... that if I clicked the Java Console would come up; but I knew nothing of what to do with the console.

I'm searching on Youtube and Google for a tutorial on the Java Console but no luck so far. Can anyone recommend any links or good books?

Some browsers require you select a menu item. They all seem different. Keep poking at it until you find it.

what to do with the console.

About all you do is read info from it.

Edited 4 Years Ago by NormR1

I'm not having any luck making my Java Console visible. The service is started.

How do I bring up the Java Console? I know this must be a stupid question to most of you out there :(

Try rebooting the PC. Maybe the change you made in the Control panel needs a boot to take effect.

This article has been dead for over six months. Start a new discussion instead.