AppletViewer not working

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
vasastrae
Posts: 7
Joined: Fri Nov 21, 2003 7:03 pm
Location: arizona

AppletViewer not working

Post by vasastrae »

When I try to run appletviewer I get this message:

I/O exception while reading: C:\Documents and Settings\Owner\Desktop\Dots.java (The filename, directory name, or volume label syntax is incorrect)

Does anyone know what the problem is?

also, what is the "Regular expression to match output" suppose to be configured to? This is under 'preferences' and 'tools'.
Thanks for the help!
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Without knowing more, and with some very rusty Java knowledge, my gut instinct says that the space in the document path is what's throwing it off.
I choose to fight with a sack of angry cats.
vasastrae
Posts: 7
Joined: Fri Nov 21, 2003 7:03 pm
Location: arizona

Post by vasastrae »

well....

i get the error message on every applet that i try to view..


Since it happens on every document that tells me it's something to with textpad and appletviewer not working together. Maybe it has to do with the "Regualar expression to match output" ?
thank you...
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

The reg exp part is used to jump the offending line when you have errors in compilation.

Code: Select all

public class HelloWorld extends java.applet.Applet
{
   public void paint(java.awt.Graphics g)
   {
        g.drawString("Hello World!", 50, 25);
        System.out.println("Hello World");
    }
}
This code, saved to c:\bfellows\test space\HelloWorld.java works a-ok when I compile and then hit run applet. Try that as an example to determine whether the issue lies within your code or the interaction of TP and Java.

And just to verify, the setting I have for the run applet tool are
command: appletviewer.exe
Parameters: $BaseName
Initial Folder: $FileDir
Reg Exp: ^.(\([^:]+\)([0-9]+\)

I may have misstyped the reg exp but I suspect a search through the forums would yield the correct one if I have erred.
I choose to fight with a sack of angry cats.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

according to the JDK documentation, the appletviewer.exe is to be called with the html page containing the applet element.

Do you call it with the java source file?
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

For me, it appeared to generate a page for it. Until I had tested it, I didn't think the setup in the tools menu would work but it will try and find an html doc in the current directory to execute against the class file and finding none, it appears to generate its own.
I choose to fight with a sack of angry cats.
nspils
Posts: 2
Joined: Thu Jan 15, 2004 1:33 am

Applet viewer not working

Post by nspils »

You might post your applet code so we can see what you're feeding the tool. Are you including the html browser markup within the comment at the top of the file (supply your own x and y values)?

/*
<applet CODE="file.class" width=x height=y>
</applet>
*/

This permits you to run the applet within the applet viewr.

I have received the error message you report with the "standalone" version of appletviewer because I did not include the file extension in the <applet CODE="FILE"> tag.However, TextPad would run it. It was not until I changed to CODE="file.class" within the tag that Sun's freestanding appletviewer would work.
vasastrae
Posts: 7
Joined: Fri Nov 21, 2003 7:03 pm
Location: arizona

Post by vasastrae »

Ok...

well, I tried that standard code and I still get the same error message
then, I tried the suggested preferences and I still get the same message..

(Let me ask you something, when you create HelloWorld.java, do you have to create a HelloWorld.html in the same folder?)

Unless I am making a stupid mistake, it's safe to assume that java and TP aren't interacting?
nspils
Posts: 2
Joined: Thu Jan 15, 2004 1:33 am

Appletviewer

Post by nspils »

To use the "Run Java Applet" tool inside of TextPad you do not have to have an HTML page with the <applet></applet> markup. You just need to have the markup within your java code (commented out, which will be skipped over by the compiler but read when the "browser" reads it ...

It sounds to me that your error message is indicating that the appletviewer is executing, but it doesn't know what the applet file is you want to run.
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Re: Appletviewer

Post by talleyrand »

nspils wrote:To use the "Run Java Applet" tool inside of TextPad you do not have to have an HTML page with the <applet></applet> markup. You just need to have the markup within your java code (commented out, which will be skipped over by the compiler but read when the "browser" reads it ...
I respectfully disagree on that one. Using java 1.4.1_01, Textpad 4.7.1, I took the aforementioned HelloWorld applet code, used the compile tool in TP, then ran the applet tool via TP. TP generated a uniquely named html file that had enough html in there to call our applet. In the case where there is more than one html file out there, a dialog box pops up asking you which html file you'd like to use or the selection of the the No option will have TP make a new one for a given .class

Vasastrae, I've put a jar (zip) file out here which contains the .java, .class and .html file. Extract the contents to a directory and I would take an iterative approach to resolve this issue.
Step 1 would be to invoke the appletviewer from the command line
i.e. C:\> c:\j2sdk1.4.1_01\bin\appletviewer.exe "\Documents and Settings\Owner\Desktop\HelloWorld.html"

If that works, then try opening the java file in TP and then run the applet tool and see what happens.
I choose to fight with a sack of angry cats.
Post Reply