Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with program

 
jake bellhorn
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

--------------------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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Load it with a browser.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you so much
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic