aspose file tools*
The moose likes Beginning Java and the fly likes problem with program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem with program" Watch "problem with program" New topic
Author

problem with program

jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24

--------------------Configuration: JDK version 1.5.0_07 <Default>--------------------
Note: C:\Documents and Settings\Martin\Desktop\lksd\PocketCalc.java uses or overrides a deprecated API.
Note: Recompile with -Xlint eprecation for details.

Process completed.
---------------------------------------------------------------------------
i keep getting that message does that mean the program will work?

<APPLET codebase=classes CODE="PocketCalc.class" WIDTH="395" HEIGHT="179">
Your browser doesn't support Java applets.
</APPLET>

ive got that as the html code, how do i make it into an applet, i noe u have to put it into notepad, ive saved it as an html file, but all it opens is the notepad program how can i fix this?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Load it with a browser.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by jake bellhorn:
...
Note: C:\Documents and Settings\Martin\Desktop\lksd\PocketCalc.java uses or overrides a deprecated API.
Note: Recompile with -Xlint eprecation for details.

Process completed.
---------------------------------------------------------------------------
i keep getting that message does that mean the program will work? ...

This is a warning that some of the methods in this code have been depreciated (for example, Button methods reshape, resize, and show). This means that Java has newer preferred ways of doing these things, and the depreciated methods should no longer be used -- especially in new code. It should still work, but there is no guarantee that it will continue to work under new versions of Java.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

In fact, you should note that the code you're using was written a decade ago using JDK 1.0 -- and it is copyright protected, so you should at least cite the source.
jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24
the thing is when i try to open it under the html file, a box comes up and on the left top corner there is an x and at the bottom of the page it says
"Applet PocketCalc notinited" will it work if i fix some of the code?
what can i fix to make it work
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by jake bellhorn:
...what can i fix to make it work

Try removing the attribute codebase=classes from your applet element in the HTML.
jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24
thank you so much
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
sorry to open up an old thread.

but I am getting this error, how do I compile, I tried looking through google.

I am working on the Head First Java 2nd Ed, and making the VerySimpleChatServer / Client pages 518-521.

the Client compiles and runs, the server compiled and ran, but I missed out a part of code, that should have sent the message back to everyone in the chat program. this line of code was that below, other than that the code is exactly as it is in the book:

once I added that, so that it should help with sending thte text back from the server to everyone.
i got an error from the VerySimpleChatServer class saying:
javac VerySimpleChatServer.java
Note: VerySimpleChatServer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint: unchecked for details

how do I compile this, and make the program work?

davy
edit: here is the code for both files:


Compiled:
javac -Xlint VerySimpleChatServer.java
VerySimpleChatServer.java:71: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.ArrayList
clientOutputStreams.add(writer);

can anyone help?
[ December 28, 2006: Message edited by: Davy Kelly ]

How simple does it have to be???
Davy Kelly
Ranch Hand

Joined: Jan 12, 2004
Posts: 384
Dont worry, I figured it out.

I was not making the ArrayList() be a PrintWriter type
ArrayList<PrintWriter> clientOutputStreams; //VerySimpleChatServer variable
clientOutputStreams = new ArrayList<PrintWriter>(); //go method in ClientHandler inner class

as this was not in the book, maybe a heads up for the publishers

davy
[ December 29, 2006: Message edited by: Davy Kelly ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with program