Java Applets, Java, I am a NOOB!!!!
OK i got a question, do you have to learn java to learn java applets, or are they two different langages, i know this about java applets
<applet code='whatever.class></applet>and A little more, but in the class file is it written in java, or a different program.
And does anybody know a good book on how to learn java applets.
Thanks, Foodman
Did you take a look at the very first link in a Google search??
http://www.google.com/search?q=java+applets
Similar Messages
-
Upgrade default java version in Solaris 8?
I have Solaris 5.8 running on sun blade system. Default Java version is 1.2.2 and user need it to upgraded to latest version of Java so, I installed jre1.6.0 (combination of 32-bit install and 64 bit install). Now I can't point solaris to look at the newly installed java version. I have tried to change the path variable in .cshrc but it is readonly to root and group is deamon. I also tried changing the symbolic link from /usr/java to /usr/jre1.6.0 but it is still looking at default version of java1.2.2.
I need help as I don't know much about Solaris to upgrade this java. Any help or guidance is greatly appreciated.
Thanks,
solaris_newbeeAfter installing, you need to update the '/usr/java' sym link to point to your new root installation. For example, I installed jdk1_5_16 at /usr/jdk/jdk1.5.0_16/ and then added this symlink:
ln -s /usr/jdk/jdk1.5.0_16/ /usr/java
You may need to remove the symlink that is already there before it will allow you to successfully create the new one.
There are several other dependent symlinks in /usr/bin that use /usr/java, but you only have to update /usr/java.
From one noob to another. -
Java noob needing help - First applet won't compile
I'm trying to make a simple audio player applet for a web page. The basic way it works is: There are four buttons Play 1, Play 2, Play 3 and Stop, as well as a label for applet credits, a label for music credits and a label for the applet's current status.
This is the applet so far:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
public class wifflesaudio extends Applet implements MouseListener {
add(new Label("(applet credits"));
add(new Label("(music credits"));
Label labelDoing = new Label("Stopped");
Button buttonOne = new Button("Play 1");
Button buttonTwo = new Button("Play 2");
Button buttonThree = new Button("Play 3");
Button buttonStop = new Button("Stop");
add(buttonOne);
add(buttonTwo);
add(buttonThree);
add(buttonStop);
addMouseListener(this);
String clipName[] = {getParameter("clipOne"),
getParameter("clipTwo"),
getParameter("clipThree")};
AudioClip clipOne;
AudioClip clipTwo;
AudioClip clipThree;
int whichIsPlaying = 0;
public void loadClip(int clipNumber) {
switch (clipNumber) {
case 1:
if (AudioClip.clipOne == null) {
try {
labelDoing = "Loading clip 1...";
clipOne = Applet.newAudioClip(newURL(getCodeBase(), clipName[1]));
catch (MalformedURLException e) {
labelDoing = "WARNING: clip 1 didn't load";
if (clipOne != null) {
clipTwo.stop();
clipThree.stop();
clipOne.loop();
whichIsPlaying = 1;
break;
case 2:
if (clipTwo == null) {
try {
labelDoing = "Loading clip 2...";
clipTwo = Applet.newAudioClip(newURL(getCodeBase(), clipName[2]));
catch (MalformedURLException e) {
labelDoing = "WARNING: clip 2 didn't load";
if (clipTwo != null) {
clipOne.stop();
clipThree.stop();
clipTwo.loop();
whichIsPlaying = 2;
break;
case 3:
if (clipThree == null) {
try {
labelDoing = "Loading clip 3...";
clipThree = Applet.newAudioClip(newURL(getCodeBase(), clipName[3]));
catch (MalformedURLException e) {
labelDoing = "WARNING: clip 3 didn't load";
if (clipTwo != null) {
clipOne.stop();
clipTwo.stop();
clipThree.loop();
whichIsPlaying = 3;
break;
public void actionPerformed(ActionEvent evt) {
Button source = (Button)evt.getSource();
if (source.getLabel().equals("Play 1")) {
loadClip(1);
if (source.getLabel().equals("Play 2")) {
loadClip(2);
if (source.getLabel().equals("Play 3")) {
loadClip(3);
if (source.getLabel().equals("Stop")) {
clipOne.stop();
clipTwo.stop();
clipThree.stop();
Naturally, it doesn't work. When I try to compile it with javac I get 21 errors thrown back at me. Being the noob that I am I have absolutely no idea why it isn't working, so I'm turning to all you clever people for some advice. :)Think anyone's going to copy your code into their own machine and compile it to see those messages for you? Well I did. Since there are a zillion error messages, I think it's fair to help a little bit:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
// no need to implement MouseListener
// see below
public class wifflesaudio extends Applet {
Label labelDoing = new Label("Stopped");
Button buttonOne = new Button("Play 1");
Button buttonTwo = new Button("Play 2");
Button buttonThree = new Button("Play 3");
Button buttonStop = new Button("Stop");
String[] clipName;
AudioClip clipOne;
AudioClip clipTwo;
AudioClip clipThree;
int whichIsPlaying = 0;
// statements in JAVA must be located with methods or constructors
// here is the default constructor (with no param)
wifflesaudio() {
add(new Label("(applet credits"));
add(new Label("(music credits"));
add(buttonOne);
add(buttonTwo);
add(buttonThree);
add(buttonStop);
clipName = new String[3];
clipName[0] = getParameter("clipOne");
clipName[1] = getParameter("clipTwo");
clipName[2] = getParameter("clipThree");
addMouseListener(new wifflesaudioMouseListener()); // instead of addMouseListener(this)
public void loadClip(int clipNumber) {
switch (clipNumber) {
case 1:
if (clipOne == null) {
try {
// To set the text of a label, you must use setText() method.
labelDoing.setText("Loading clip 1...");
clipOne = newAudioClip(new URL(getCodeBase(), clipName[1])); // 'new URL' instead of 'newURL'
} catch (MalformedURLException e) {
// To set the text of a label, you must use setText() method.
labelDoing.setText("WARNING: clip 1 didn't load");
if (clipOne != null) {
clipTwo.stop();
clipThree.stop();
clipOne.loop();
whichIsPlaying = 1;
break;
case 2:
if (clipTwo == null) {
try {
// To set the text of a label, you must use setText() method.
labelDoing.setText("Loading clip 2...");
clipTwo = newAudioClip(new URL(getCodeBase(), clipName[2])); // 'new URL' instead of 'newURL'
} catch (MalformedURLException e) {
// To set the text of a label, you must use setText() method.
labelDoing.setText("WARNING: clip 2 didn't load");
if (clipTwo != null) {
clipOne.stop();
clipThree.stop();
clipTwo.loop();
whichIsPlaying = 2;
break;
case 3:
if (clipThree == null) {
try {
// To set the text of a label, you must use setText() method.
labelDoing.setText("Loading clip 3...");
clipThree = newAudioClip(new URL(getCodeBase(), clipName[3])); // 'new URL' instead of 'newURL'
} catch (MalformedURLException e) {
// To set the text of a label, you must use setText() method.
labelDoing.setText("WARNING: clip 3 didn't load");
if (clipTwo != null) {
clipOne.stop();
clipTwo.stop();
clipThree.loop();
whichIsPlaying = 3;
break;
public void actionPerformed(ActionEvent evt) {
Button source = (Button)evt.getSource();
if (source.getLabel().equals("Play 1")) {
loadClip(1);
if (source.getLabel().equals("Play 2")) {
loadClip(2);
if (source.getLabel().equals("Play 3")) {
loadClip(3);
if (source.getLabel().equals("Stop")) {
clipOne.stop();
clipTwo.stop();
clipThree.stop();
// Extending MouseAdapter instead of implementing MouseListener
// allows NOT to code ALL the methods from MouseListener
// MouseAdapter already implements MouseListener with empty methods
// You then just code the method(s) that is (are) needed.
class wifflesaudioMouseListener extends MouseAdapter {
}Please next time paste your code between code tags exactly like this:
[code]
your code
[/code]
Thank you -
Warning Noob: Sending "Hello World!" in Printer using Java Applet
Hello guys!
im a newbie in java programming... i hope that you can help me with my problem.
how can i print "Hello World!" in printer using java applet. lets pretend that the applet is digitally signed.
i tried window.print in javascript but unfortunately, that is not what i am looking for.
thanks for reading my post and i hope that you help me with my quest in java =)An applet is still part of the Swing package. I assume you're extending JApplet. There isn't anything in the print API that says it can't be done in an applet. Except that you might have to sign your applet Jar file with a digital certificate to get the printing to work.
-
How to make sure an applet runs with Java 5?
Hi all,
First let me say thanks for all the help in the past. You've help me go from noob to intermediate noob. I've just about finished my first applet game which can be checked out here .
Now I've been reading about problems with mac and 1.6. (note it works on Linux). I want to make sure that it runs fine and of course I don't own a mac. So I downloaded the 5 JDK. Selected it as the java platform in Netbeans, compiled and it ran fine.
Questions:
Do I have to always use 1.5 to compile and perhaps set it as default?
Since it works in 1.5, do I compile it with 1.6 and just upload?
I'm worried I'm not testing it correctly. I mean if I have both 1.5 and 1.6 installed on my machine, how to I make sure the applet is only using 1.5 to run?
Thanks
Darrincorlettk wrote:
I haven't got a clue RE your problem other than for max-portability you should compile with [-target 1.5|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html].
I must say I'm impressed, except I suspect my PC must be substantially faster than any of your test platforms... can you throttle it to CPU performance somehow? Or maybe it's just that my reflexes aren't what they once where.Thanks.
There seem to be two issues. The first is what people are using. This web stats shows pretty poor penetration of 1.6.
[http://www.statowl.com/java.php|http://www.statowl.com/java.php] Penetration: 54% with JRE1.6 + 19% with JRE 1.5. Total 73%.
The second is I've read that mac and 1.6 do not get along except on a 64bit platform.
So for applets there is not much choice but to compile on 1.5 for the broadest user base. I guess the good news is 1.4 and earlier are almost non-existent.
Edited by: Darrin.A on Apr 27, 2009 8:11 AM -
Ok i know i haven't read the applet tutorial or had much experience with applets but just hear me out and see if you can help me.
BACKGROUND
Ok...so i have previously viewed an applet on windows viewing an html file on my computer. I am trying to view just the most simple applet (helloworld) on linux. I'm using Ubuntu linux, the latest version as of February 23, 2006.I created an applet file and an html file in the same directory with the html file having an <applet> tag in it linking to the HelloWorldApp. I have tried viewing the html file and the java applet won't load. Everything other than the applet worked and I'm just stuck.
So my plea is would somebody please just paste the bare minimum html file and applet file that you can see an applet with? I want to learn about applets and will do the tutorial but I would really like to just see one.
Please help,
A frustrated applet noob
p.s.
According to java.com I have installed JRE 5.0 and i have compiled a java application so I'm pretty sure I have successfully installed JDK 5.0.Bob, what web browser are you using?
Make sure that the browser supports Java applets.
If you want just to debug your applet try appletviewer utility
from JDK first. -
Applet java file not refreshing in browser
I have an applet that I am updating and I am not seeing the corresponding update when I open the web page. I can manually download the java class file and look inside it and it definitely is the updated file. I have deleted the browser history. (I am running tests with Firefox 3, IE7, and Safari 4 public beta). Is there something else I need to do to make sure the browser pulls in the latest version of the class file referenced in the html?
Here is the code:
<HTML>
<HEAD>
<TITLE>A Simple Program</TITLE>
</HEAD>
<BODY>
<CENTER>
<APPLET CODE="SendRequest.class" WIDTH="500" HEIGHT="150">
</APPLET>
</CENTER>
</BODY>
</HTML>The applet refers to a hard coded URL to read through a urlconnection. It is always reading a file and showing content, but it is not showing the right file. If I change the name of the referenced file in the java program, it looks like the browser has cached the referred file, rather than throwing and error and saying the file doesn't exist.
Here is the java
import java.applet.*;
import java.awt.*;
import java.net.URLConnection;
import java.net.URL;
import org.w3c.dom.Document;
import java.lang.String;
import java.io.*;
public class SendRequest extends Applet {
@Override
public void paint(Graphics g) {
g.drawRect(0, 0, 499, 149);
g.drawString(getResponseText(), 5, 70);
public String getResponseText() {
try {
URL url = new URL("http://myserver.com/stats/logs/ex20090603000001-72.167.131.217.log");
URLConnection urlconn = url.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
urlconn.getInputStream()));
String inputLine;
String htmlFile = "";
try {
while ((inputLine = in.readLine()) != null)
htmlFile += inputLine;
in.close();
return htmlFile;
} catch (Exception e) {
return "Can't get the string.";
} catch (Exception e) {
return "Problem accessing the response text.";
}Any help would be appreciated. I heard that some files may cache more persistently than others, but I don't fully understand the details.
Thanks,
JimCheck this [document loader example|http://pscode.org/test/docload/] & follow the link to sandbox.html for tips on clearing the class cache. That relates specifically to caching a refused security certificate, but class caching is much the same. As an aside, getting a console can be tricky in modern times (unless the applet fails completely). It is handy to configure the [Java Control Panel|http://java.sun.com/docs/books/tutorial/information/player.jnlp] to pop the Java console on finding an applet (Advanced tab - Settings/Java Console/Show Console).
Of course there are two better tools for testing applets, especially in regard to class caching. AppletViewer and Appleteer both make class refresh fairly easy. Appleteer is the better of the two. I can tell you that with confidence, since I wrote it. ;-) -
Java.awt.createFont(...) in Applet
I'm trying to dynamically load a truetype-font in an applet with Font.createFont(...) .
Unfortunately I'm always getting
java.lang.SecurityException: Unable to create temporary fileAnd, surprise, surprise, Font.createFont() requires a temporary file wich I found not to be documented in javadoc but in the source of Font.java (see last line of the next code example):
public static Font createFont ( int fontFormat, InputStream fontStream )
throws java.awt.FontFormatException, java.io.IOException {
if ( fontFormat != Font.TRUETYPE_FONT ) {
throw new IllegalArgumentException ( "font format not recognized" );
File fontFile = null;
fontFile = File.createTempFile ( "font", ".ttf", null );Has anybody faced the same problem or an idea of how to solve this issue with little additional work?has really nobody got an idea?
-
Hello,
I have a customer that is looking to set up SSO with an application that uses a Java Applet as its login screen to the app.
Any advice on how this can be set up. SSO via External Application doesn't seem to work since it doesn't use a GET or POST method.
Thank You!
PadminiAn applet (with normal security setup) can only open up socket connections to the host from whence the applet came. Sounds like your applet is trying to talk to port 5000 on the client's box. Can't do that, unless:
a) The client's box is the server (which is the case under your first scenario)
b) The applet is signed or otherwise set up to be "trusted" that it doesn't contain harmful code.
The security policy is there for a reason. I, for example, wouldn't want to stumble across some rogue applet out on the internet which then tries to open up socket connections to things on my corporate intranet or local machine -- unless I KNEW it was going to do that (I "trust" it). -
Problem converting a (working) Java program into an applet
When I'm trying to access an Image through a call to :
mediaTracker = new MediaTracker(this);
backGroundImage = getImage(getDocumentBase(), "background.gif");
mediaTracker.addImage(backGroundImage, 0);
I'm getting a nullPointerException as a result of the call to getDocumentBase() :
C:\Chantier\Java\BallsApplet
AppletViewer testBallsApplet.htmljava.lang.NullPointerException
at java.applet.Applet.getDocumentBase(Applet.java:125)
at Balls.<init>(Balls.java:84)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:296)
at java.lang.Class.newInstance(Class.java:249)
at sun.applet.AppletPanel.createApplet(AppletPanel.java:548)
at sun.applet.AppletPanel.runLoader(AppletPanel.java:477)
at sun.applet.AppletPanel.run(AppletPanel.java:290)
at java.lang.Thread.run(Thread.java:536)
It seems very weird to me... :-/
(all the .gif files are in the same directory than the .class files)
The problem appears with AppletViewer trying to open an HTML file
containing :
<HTML>
<APPLET CODE="Balls.class" WIDTH=300 HEIGHT=211>
</APPLET>
</HTML>
(I tried unsuccessfully the CODEBASE and ARCHIVE attributes, with and without putting the .gif and .class into a .jar file)
I can't find the solution by myself, so, I'd be very glad if someone could help
me with this... Thank you very much in advance ! :-)
You'll find below the source of a small game that I wrote and debugged (without
problem) and that I'm now (unsuccessfully) trying to convert into an Applet :
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.URL;
public class Balls extends java.applet.Applet implements Runnable, KeyListener
private Image offScreenImage;
private Image backGroundImage;
private Image[] gifImages = new Image[6];
private Image PressStart ;
private Sprite pressStartSprite = null ;
private Image YouLose ;
private Sprite YouLoseSprite = null ;
private Image NextStage ;
private Sprite NextStageSprite = null ;
private Image GamePaused ;
private Sprite GamePausedSprite = null ;
//offscreen graphics context
private Graphics offScreenGraphicsCtx;
private Thread animationThread;
private MediaTracker mediaTracker;
private SpriteManager spriteManager;
//Animation display rate, 12fps
private int animationDelay = 83;
private Random rand = new Random(System.currentTimeMillis());
private int message = 0 ; // 0 = no message (normal playing phase)
// 1 = press space to start
// 2 = press space for next level
// 3 = game PAUSED, press space to unpause
// 4 = You LOSE
public static void main(String[] args)
try
new Balls() ;
catch (java.net.MalformedURLException e)
System.out.println(e);
}//end main
public void start()
//Create and start animation thread
animationThread = new Thread(this);
animationThread.start();
public void init()
try
new Balls() ;
catch (java.net.MalformedURLException e)
System.out.println(e);
public Balls() throws java.net.MalformedURLException
{//constructor
// Load and track the images
mediaTracker = new MediaTracker(this);
backGroundImage = getImage(getDocumentBase(), "background.gif");
mediaTracker.addImage(backGroundImage, 0);
PressStart = getImage(getDocumentBase(), "press_start.gif");
mediaTracker.addImage(PressStart, 0);
NextStage = getImage(getDocumentBase(), "stage_complete.gif");
mediaTracker.addImage(NextStage, 0);
GamePaused = getImage(getDocumentBase(), "game_paused.gif");
mediaTracker.addImage(GamePaused, 0);
YouLose = getImage(getDocumentBase(), "you_lose.gif");
mediaTracker.addImage(YouLose, 0);
//Get and track 6 images to use
// for sprites
gifImages[0] = getImage(getDocumentBase(), "blueball.gif");
mediaTracker.addImage(gifImages[0], 0);
gifImages[1] = getImage(getDocumentBase(), "redball.gif");
mediaTracker.addImage(gifImages[1], 0);
gifImages[2] = getImage(getDocumentBase(), "greenball.gif");
mediaTracker.addImage(gifImages[2], 0);
gifImages[3] = getImage(getDocumentBase(), "yellowball.gif");
mediaTracker.addImage(gifImages[3], 0);
gifImages[4] = getImage(getDocumentBase(), "purpleball.gif");
mediaTracker.addImage(gifImages[4], 0);
gifImages[5] = getImage(getDocumentBase(), "orangeball.gif");
mediaTracker.addImage(gifImages[5], 0);
//Block and wait for all images to
// be loaded
try {
mediaTracker.waitForID(0);
}catch (InterruptedException e) {
System.out.println(e);
}//end catch
//Base the Frame size on the size
// of the background image.
//These getter methods return -1 if
// the size is not yet known.
//Insets will be used later to
// limit the graphics area to the
// client area of the Frame.
int width = backGroundImage.getWidth(this);
int height = backGroundImage.getHeight(this);
//While not likely, it may be
// possible that the size isn't
// known yet. Do the following
// just in case.
//Wait until size is known
while(width == -1 || height == -1)
System.out.println("Waiting for image");
width = backGroundImage.getWidth(this);
height = backGroundImage.getHeight(this);
}//end while loop
//Display the frame
setSize(width,height);
setVisible(true);
//setTitle("Balls");
//Anonymous inner class window
// listener to terminate the
// program.
this.addWindowListener
(new WindowAdapter()
{public void windowClosing(WindowEvent e){System.exit(0);}});
// Add a key listener for keyboard management
this.addKeyListener(this);
}//end constructor
public void run()
Point center_place = new Point(
backGroundImage.getWidth(this)/2-PressStart.getWidth(this)/2,
backGroundImage.getHeight(this)/2-PressStart.getHeight(this)/2) ;
pressStartSprite = new Sprite(this, PressStart, center_place, new Point(0, 0),true);
center_place = new Point(
backGroundImage.getWidth(this)/2-NextStage.getWidth(this)/2,
backGroundImage.getHeight(this)/2-NextStage.getHeight(this)/2) ;
NextStageSprite = new Sprite(this, NextStage, center_place, new Point(0, 0),true);
center_place = new Point(
backGroundImage.getWidth(this)/2-GamePaused.getWidth(this)/2,
backGroundImage.getHeight(this)/2-GamePaused.getHeight(this)/2) ;
GamePausedSprite = new Sprite(this, GamePaused, center_place, new Point(0, 0),true);
center_place = new Point(
backGroundImage.getWidth(this)/2-YouLose.getWidth(this)/2,
backGroundImage.getHeight(this)/2-YouLose.getHeight(this)/2) ;
YouLoseSprite = new Sprite(this, YouLose, center_place, new Point(0, 0),true);
BackgroundImage bgimage = new BackgroundImage(this, backGroundImage) ;
for (;;) // infinite loop
long time = System.currentTimeMillis();
message = 1 ; // "press start to begin"
while (message != 0)
repaint() ;
try
time += animationDelay;
Thread.sleep(Math.max(0,time - System.currentTimeMillis()));
catch (InterruptedException e)
System.out.println(e);
}//end catch
boolean you_lose = false ;
for (int max_speed = 7 ; !you_lose && max_speed < 15 ; max_speed++)
for (int difficulty = 2 ; !you_lose && difficulty < 14 ; difficulty++)
boolean unfinished_stage = true ;
spriteManager = new SpriteManager(bgimage);
spriteManager.setParameters(difficulty, max_speed) ;
//Create 15 sprites from 6 gif
// files.
for (int cnt = 0; cnt < 15; cnt++)
if (cnt == 0)
Point position = new Point(
backGroundImage.getWidth(this)/2-gifImages[0].getWidth(this)/2,
backGroundImage.getHeight(this)/2-gifImages[0].getHeight(this)/2) ;
spriteManager.addSprite(makeSprite(position, 0, false));
else
Point position = spriteManager.
getEmptyPosition(new Dimension(gifImages[0].getWidth(this),
gifImages[0].getHeight(this)));
if (cnt < difficulty)
spriteManager.addSprite(makeSprite(position, 1, true));
else
spriteManager.addSprite(makeSprite(position, 2, true));
}//end for loop
time = System.currentTimeMillis();
while (!spriteManager.getFinishedStage() && !spriteManager.getGameOver())
// Loop, sleep, and update sprite
// positions once each 83
// milliseconds
spriteManager.update();
repaint();
try
time += animationDelay;
Thread.sleep(Math.max(0,time - System.currentTimeMillis()));
catch (InterruptedException e)
System.out.println(e);
}//end catch
}//end while loop
if (spriteManager.getGameOver())
message = 4 ;
while (message != 0)
spriteManager.update();
repaint();
try
time += animationDelay;
Thread.sleep(Math.max(0,time - System.currentTimeMillis()));
catch (InterruptedException e)
System.out.println(e);
}//end catch
you_lose = true ;
if (spriteManager.getFinishedStage())
message = 2 ;
while (message != 0)
spriteManager.update();
repaint();
try
time += animationDelay;
Thread.sleep(Math.max(0,time - System.currentTimeMillis()));
catch (InterruptedException e)
System.out.println(e);
}//end catch
} // end for difficulty loop
} // end for max_speed
} // end infinite loop
}//end run method
private Sprite makeSprite(Point position, int imageIndex, boolean wind)
return new Sprite(
this,
gifImages[imageIndex],
position,
new Point(rand.nextInt() % 5,
rand.nextInt() % 5),
wind);
}//end makeSprite()
//Overridden graphics update method
// on the Frame
public void update(Graphics g)
//Create the offscreen graphics
// context
if (offScreenGraphicsCtx == null)
offScreenImage = createImage(getSize().width,
getSize().height);
offScreenGraphicsCtx = offScreenImage.getGraphics();
}//end if
if (message == 0)
// Draw the sprites offscreen
spriteManager.drawScene(offScreenGraphicsCtx);
else if (message == 1)
pressStartSprite.drawSpriteImage(offScreenGraphicsCtx);
else if (message == 2)
NextStageSprite.drawSpriteImage(offScreenGraphicsCtx);
else if (message == 3)
GamePausedSprite.drawSpriteImage(offScreenGraphicsCtx);
else if (message == 4)
YouLoseSprite.drawSpriteImage(offScreenGraphicsCtx);
// Draw the scene onto the screen
if(offScreenImage != null)
g.drawImage(offScreenImage, 0, 0, this);
}//end if
}//end overridden update method
//Overridden paint method on the
// Frame
public void paint(Graphics g)
//Nothing required here. All
// drawing is done in the update
// method above.
}//end overridden paint method
// Methods to handle Keyboard event
public void keyPressed(KeyEvent evt)
int key = evt.getKeyCode(); // Keyboard code for the pressed key.
if (key == KeyEvent.VK_SPACE)
if (message != 0)
message = 0 ;
else
message = 3 ;
if (key == KeyEvent.VK_LEFT)
if (spriteManager != null)
spriteManager.goLeft() ;
else if (key == KeyEvent.VK_RIGHT)
if (spriteManager != null)
spriteManager.goRight() ;
else if (key == KeyEvent.VK_UP)
if (spriteManager != null)
spriteManager.goUp() ;
else if (key == KeyEvent.VK_DOWN)
if (spriteManager != null)
spriteManager.goDown() ;
if (spriteManager != null)
spriteManager.setMessage(message) ;
public void keyReleased(KeyEvent evt)
public void keyTyped(KeyEvent e)
char key = e.getKeyChar() ;
//~ if (key == 's')
//~ stop = true ;
//~ else if (key == 'c')
//~ stop = false ;
//~ spriteManager.setStop(stop) ;
}//end class Balls
//===================================//
class BackgroundImage
private Image image;
private Component component;
private Dimension size;
public BackgroundImage(
Component component,
Image image)
this.component = component;
size = component.getSize();
this.image = image;
}//end construtor
public Dimension getSize(){
return size;
}//end getSize()
public Image getImage(){
return image;
}//end getImage()
public void setImage(Image image){
this.image = image;
}//end setImage()
public void drawBackgroundImage(Graphics g)
g.drawImage(image, 0, 0, component);
}//end drawBackgroundImage()
}//end class BackgroundImage
//===========================
class SpriteManager extends Vector
private BackgroundImage backgroundImage;
private boolean finished_stage = false ;
private boolean game_over = false ;
private int difficulty ;
private int max_speed ;
public boolean getFinishedStage()
finished_stage = true ;
for (int cnt = difficulty ; cnt < size(); cnt++)
Sprite sprite = (Sprite)elementAt(cnt);
if (!sprite.getEaten())
finished_stage = false ;
return finished_stage ;
public boolean getGameOver() {return game_over ;}
public void setParameters(int diff, int speed)
difficulty = diff ;
max_speed = speed ;
finished_stage = false ;
game_over = false ;
Sprite sprite;
for (int cnt = 0;cnt < size(); cnt++)
sprite = (Sprite)elementAt(cnt);
sprite.setSpeed(max_speed) ;
public SpriteManager(BackgroundImage backgroundImage)
this.backgroundImage = backgroundImage ;
}//end constructor
public Point getEmptyPosition(Dimension spriteSize)
Rectangle trialSpaceOccupied = new Rectangle(0, 0,
spriteSize.width,
spriteSize.height);
Random rand = new Random(System.currentTimeMillis());
boolean empty = false;
int numTries = 0;
// Search for an empty position
while (!empty && numTries++ < 100)
// Get a trial position
trialSpaceOccupied.x =
Math.abs(rand.nextInt() %
backgroundImage.
getSize().width);
trialSpaceOccupied.y =
Math.abs(rand.nextInt() %
backgroundImage.
getSize().height);
// Iterate through existing
// sprites, checking if position
// is empty
boolean collision = false;
for(int cnt = 0;cnt < size(); cnt++)
Rectangle testSpaceOccupied = ((Sprite)elementAt(cnt)).getSpaceOccupied();
if (trialSpaceOccupied.intersects(testSpaceOccupied))
collision = true;
}//end if
}//end for loop
empty = !collision;
}//end while loop
return new Point(trialSpaceOccupied.x, trialSpaceOccupied.y);
}//end getEmptyPosition()
public void update()
Sprite sprite;
// treat special case of sprite #0 (the player)
sprite = (Sprite)elementAt(0);
sprite.updatePosition() ;
int hitIndex = testForCollision(sprite);
if (hitIndex != -1)
if (hitIndex < difficulty)
{ // if player collides with an hunter (red ball), he loose
sprite.setEaten() ;
game_over = true ;
else
// if player collides with an hunted (green ball), he eats the green
((Sprite)elementAt(hitIndex)).setEaten() ;
//Iterate through sprite list
for (int cnt = 1;cnt < size(); cnt++)
sprite = (Sprite)elementAt(cnt);
//Update a sprite's position
sprite.updatePosition();
//Test for collision. Positive
// result indicates a collision
hitIndex = testForCollision(sprite);
if (hitIndex >= 0)
//a collision has occurred
bounceOffSprite(cnt,hitIndex);
}//end if
}//end for loop
}//end update
public void setMessage(int message)
Sprite sprite;
//Iterate through sprite list
for (int cnt = 0;cnt < size(); cnt++)
sprite = (Sprite)elementAt(cnt);
//Update a sprite's stop status
sprite.setMessage(message);
}//end for loop
}//end update
public void goLeft()
Sprite sprite = (Sprite)elementAt(0);
sprite.goLeft() ;
public void goRight()
Sprite sprite = (Sprite)elementAt(0);
sprite.goRight() ;
public void goUp()
Sprite sprite = (Sprite)elementAt(0);
sprite.goUp() ;
public void goDown()
Sprite sprite = (Sprite)elementAt(0);
sprite.goDown() ;
private int testForCollision(Sprite testSprite)
//Check for collision with other
// sprites
Sprite sprite;
for (int cnt = 0;cnt < size(); cnt++)
sprite = (Sprite)elementAt(cnt);
if (sprite == testSprite)
//don't check self
continue;
//Invoke testCollision method
// of Sprite class to perform
// the actual test.
if (testSprite.testCollision(sprite))
//Return index of colliding
// sprite
return cnt;
}//end for loop
return -1;//No collision detected
}//end testForCollision()
private void bounceOffSprite(int oneHitIndex, int otherHitIndex)
//Swap motion vectors for
// bounce algorithm
Sprite oneSprite = (Sprite)elementAt(oneHitIndex);
Sprite otherSprite = (Sprite)elementAt(otherHitIndex);
Point swap = oneSprite.getMotionVector();
oneSprite.setMotionVector(otherSprite.getMotionVector());
otherSprite.setMotionVector(swap);
}//end bounceOffSprite()
public void drawScene(Graphics g)
//Draw the background and erase
// sprites from graphics area
//Disable the following statement
// for an interesting effect.
backgroundImage.drawBackgroundImage(g);
//Iterate through sprites, drawing
// each sprite
for (int cnt = 0;cnt < size(); cnt++)
((Sprite)elementAt(cnt)).drawSpriteImage(g);
}//end drawScene()
public void addSprite(Sprite sprite)
addElement(sprite);
}//end addSprite()
}//end class SpriteManager
//===================================//
class Sprite
private Component component;
private Image image;
private Rectangle spaceOccupied;
private Point motionVector;
private Rectangle bounds;
private Random rand;
private int message = 0 ; // number of message currently displayed (0 means "no message" = normal game)
private int max_speed = 7 ;
private boolean eaten = false ; // when a green sprite is eaten, it is no longer displayed on screen
private boolean wind = true ;
private boolean go_left = false ;
private boolean go_right = false ;
private boolean go_up = false ;
private boolean go_down = false ;
public Sprite(Component component,
Image image,
Point position,
Point motionVector,
boolean Wind
//Seed a random number generator
// for this sprite with the sprite
// position.
rand = new Random(position.x);
this.component = component;
this.image = image;
setSpaceOccupied(new Rectangle(
position.x,
position.y,
image.getWidth(component),
image.getHeight(component)));
this.motionVector = motionVector;
this.wind = Wind ;
//Compute edges of usable graphics
// area in the Frame.
int topBanner = ((Container)component).getInsets().top;
int bottomBorder = ((Container)component).getInsets().bottom;
int leftBorder = ((Container)component).getInsets().left;
int rightBorder = ((Container)component).getInsets().right;
bounds = new Rectangle( 0 + leftBorder, 0 + topBanner
, component.getSize().width - (leftBorder + rightBorder)
, component.getSize().height - (topBanner + bottomBorder));
}//end constructor
public void setMessage(int message_number)
message = message_number ;
public void setSpeed(int speed)
max_speed = speed ;
public void goLeft()
go_left = true ;
public void goRight()
go_right = true ;
public void goUp()
go_up = true ;
public void goDown()
go_down = true ;
public void setEaten()
eaten = true ;
setSpaceOccupied(new Rectangle(4000,4000,0,0)) ;
public boolean getEaten()
return eaten ;
public Rectangle getSpaceOccupied()
return spaceOccupied;
}//end getSpaceOccupied()
void setSpaceOccupied(Rectangle spaceOccupied)
this.spaceOccupied = spaceOccupied;
}//setSpaceOccupied()
public void setSpaceOccupied(
Point position){
spaceOccupied.setLocation(
position.x, position.y);
}//setSpaceOccupied()
public Point getMotionVector(){
return motionVector;
}//end getMotionVector()
public void setMotionVector(
Point motionVector){
this.motionVector = motionVector;
}//end setMotionVector()
public void setBounds(Rectangle bounds)
this.bounds = bounds;
}//end setBounds()
public void updatePosition()
Point position = new Point(spaceOccupied.x, spaceOccupied.y);
if (message != 0)
return ;
//Insert random behavior. During
// each update, a sprite has about
// one chance in 10 of making a
// random change to its
// motionVector. When a change
// occurs, the motionVector
// coordinate values are forced to
// fall between -7 and 7. This
// puts a cap on the maximum speed
// for a sprite.
if (!wind)
if (go_left)
motionVector.x -= 2 ;
if (motionVector.x < -15)
motionVector.x = -14 ;
go_left = false ;
if (go_right)
motionVector.x += 2 ;
if (motionVector.x > 15)
motionVector.x = 14 ;
go_right = false ;
if (go_up)
motionVector.y -= 2 ;
if (motionVector.y < -15)
motionVector.y = -14 ;
go_up = false ;
if (go_down)
motionVector.y += 2 ;
if (motionVector.y > 15)
motionVector.y = 14 ;
go_down = false ;
else if(rand.nextInt() % 7 == 0)
Point randomOffset =
new Point(rand.nextInt() % 3,
rand.nextInt() % 3);
motionVector.x += randomOffset.x;
if(motionVector.x >= max_speed)
motionVector.x -= max_speed;
if(motionVector.x <= -max_speed)
motionVector.x += max_speed ;
motionVector.y += randomOffset.y;
if(motionVector.y >= max_speed)
motionVector.y -= max_speed;
if(motionVector.y <= -max_speed)
motionVector.y += max_speed;
}//end if
//Move the sprite on the screen
position.translate(motionVector.x, motionVector.y);
//Bounce off the walls
boolean bounceRequired = false;
Point tempMotionVector = new Point(
motionVector.x,
motionVector.y);
//Handle walls in x-dimension
if (position.x < bounds.x)
bounceRequired = true;
position.x = bounds.x;
//reverse direction in x
tempMotionVector.x = -tempMotionVector.x;
else if ((position.x + spaceOccupied.width) > (bounds.x + bounds.width))
bounceRequired = true;
position.x = bounds.x +
bounds.width -
spaceOccupied.width;
//reverse direction in x
tempMotionVector.x =
-tempMotionVector.x;
}//end else if
//Handle walls in y-dimension
if (position.y < bounds.y)
bounceRequired = true;
position.y = bounds.y;
tempMotionVector.y = -tempMotionVector.y;
else if ((position.y + spaceOccupied.height)
> (bounds.y + bounds.height))
bounceRequired = true;
position.y = bounds.y +
bounds.height -
spaceOccupied.height;
tempMotionVector.y =
-tempMotionVector.y;
}//end else if
if(bounceRequired)
//save new motionVector
setMotionVector(
tempMotionVector);
//update spaceOccupied
setSpaceOccupied(position);
}//end updatePosition()
public void drawSpriteImage(Graphics g)
if (!eaten)
g.drawImage(image,
spaceOccupied.x,
spaceOccupied.y,
component);
}//end drawSpriteImage()
public boolean testCollision(Sprite testSprite)
//Check for collision with
// another sprite
if (testSprite != this)
return spaceOccupied.intersects(
testSprite.getSpaceOccupied());
}//end if
return false;
}//end testCollision
}//end Sprite class
//===================================//
Thanks for your help...Sorry,
Can you tell me how do you solve it because I have got the same problem.
Can you indicate me the topic where did you find solution.
Thank in advance. -
Can I save as pdf when printing from a Java applet on a webpage in Safari?
I am trying to use a webpage that is running a Java applet. A dialog comes up that asks me, "Do you want to run this application?" The dialog also says, "This application will run with limited access that is intended to protect your computer and personal information." I select "Run". The applet generates an image I want to print. There is a "Print" button on the applet. I select "Print". A Security Warning dialog comes up that says, "The applet has requested access to the printer. Do you want to allow this action?" I select "OK". The Print dialog comes up. I choose the PDF button in the lower left corner. I choose "Save as PDF...". A second Print dialog comes up. I input a title in the Save As box. I choose Desktop in the Where box. I do not change anything else and select the "Save" button. A dialog appears that says, "Print Error while printing." There is an icon with paper, a pencil, a ruler and a paintbrush on the dialog.
Is this an issue with Apple and Java security? Does "run with limited access" mean I can't print and save as PDF? Should I upgrade to Mavericks? It seems like others have not been happy with Mavericks and have had problems saving as PDF with Mavericks. How do I let Apple know about this error? The error dialog is useless.
I am on a Mac running OS X 10.8.5 and Safari 6.1.2. My Java version is 7 update 51.
What other information can I provide to help solve the problem (if it can be solved)?
Thank you for your help!Correction I would like to save as PDF/A-1b
for archiving.
http://www.adobe.com/enterprise/standards/pdfa/ -
Problem Launching Java Applet with Plug-in: Version 1.4.2_01
Hello out there:
I recently installed j2re-1.4.2_01 on my home computer but have been unable to access Web sites emmploying JAva applets. The following is an email exchange with Jeff Hall of Lowell Observatory, manager of an educational site hosted by Lowell, trying to resolve my problem. The messages are better understood if read in reverse order.
I'm hoping that someone will recognize the source of my problem and can recommmend a solution. I would appreciate any help offered.
Thanks,
Mike Coucke
Hi Jeff:
Well, I guess the problem lies with me somewhere. Here's my answer/status to your questions/suggestions:
1) I'm using MS Windows Me version 4.90.3000
2) I do have the directory C:\Windows\.jpi_cache\jar\, but the only thing in it is an empty folder labeled "1.0". The file LP.jar does not exist anywhere on my hard drive.
3) I tried several game sites that utilized Java applets and got the same results: the Java cup in the upper left corner followed a few seconds later by the red "X". So, evidently the problem is somewhere on my end.
I'm going to post our email exchanges in a Java Users Forum managed by Sun to see if anyone out there can solve my problem. However, if you have any more suggestions, I'll be glad to try them.
Thanks for the help.
Mike Coucke
[email protected]
----- Original Message -----
From: "Jeffrey Hall" <[email protected]>
To: "'Mike Coucke'" <[email protected]>
Sent: Friday, September 05, 2003 1:02 PM
Subject: RE: Registration with Lowell Education Online
Mike,
Rats! What version of Windows are you using? It's a little strange to
see the user directory set to C:\Windows; if you're using XP, I'd expect
it to be something like C:\Documents and Settings\Mike Coucke. In any
event, the output that is of concern is these two lines:
java.lang.ClassNotFoundException: LPRemote.class
Caused by: java.net.UnknownHostException: proxy
It looks like your browser is not finding our server's IP when it comes
time to download the necessary Java code.
LPRemote.class is the fundamental code that runs LOPARC, and your
browser should be downloading it automatically when you click connect.
LPRemote.class is stored along with a bunch of other classes in a file
called "LP.jar" that you download from our server. So, if you go to C:
in Windows Explorer and do a file search for LP.jar, you should find it.
On my machine, it's stored in a directory called ".jpi_cache\jar\" in my
user home directory. Let me know if you have this file, or the
jpi-cache directory.
One other thing you might try is going to a different site that you know
uses Java applets -- I think some of the online game rooms at Yahoo use
Java. See if other sites that use Java load correctly. Then we'll know
if it's our server specifically, or a more general problem on your end.
Jeff Hall
Lowell Observatory
Hello Jeff:
I still have the Java "blues". I followed your instructions, but am still unable to launch a LOPARC session. After an initial failure, I uninstalled all three Java versions I had (1.4.0, 1.4.1, 1.4.2), then reinstalled 1.4.2_01 from the Sun website.
Now, when I try to launch LOPARC, I initially get a blank window with the Java cup in the upper left corner. After about 20 seconds, the cup changes to a red "X". During those 20 seconds, the following appear in the IE message bar at the bottom of the window: "Applet LPRemote notinited" (their spelling) which changes to "Loading Java Applet Failed..." when the red "X" appears.
Following is a copy of the log from my Java Console during all of this:
Java(TM) Plug-in: Version 1.4.2_01
Using JRE version 1.4.2_01 Java HotSpot(TM) Client VM
User home directory = C:\WINDOWS
Proxy Configuration: Manual Configuration
Proxy: http=proxy,https=proxy,ftp=proxy,gopher=proxy
Proxy Overrides:
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
load: class LPRemote.class not found.
java.lang.ClassNotFoundException: LPRemote.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.UnknownHostException: proxy
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.plugin.net.protocol.http.HttpClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.http.HttpClient.privilegedOpenServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.net.www.http.HttpClient.<init>(Unknown Source)
at sun.plugin.net.protocol.http.HttpClient.<init>(Unknown Source)
at sun.plugin.net.protocol.http.HttpClient.New(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.createConnection(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
I followed this up by executing the following three console commands:
"dump system properties"
"dump classholder list"
"dump thread list"
and obtained the following listings:
Dump system properties ...
acl.read = +
acl.read.default =
acl.write = +
acl.write.default =
application.home = C:\PROGRA~1\JAVA\J2RE14~1.2_0
awt.toolkit = sun.awt.windows.WToolkit
browser = sun.plugin
browser.vendor = Sun Microsystems, Inc.
browser.version = 1.1
deployment.javaws.cache.dir = C:\WINDOWS\.javaws\cache
deployment.javaws.jre.0.enabled = true
deployment.javaws.jre.0.location = http://java.sun.com/products/autodl/j2se
deployment.javaws.jre.0.osarch = x86
deployment.javaws.jre.0.osname = Windows
deployment.javaws.jre.0.path = C:\Program Files\Java\j2re1.4.2_01\bin\javaw.exe
deployment.javaws.jre.0.platform = 1.4
deployment.javaws.jre.0.product = 1.4.2_01
deployment.javaws.jre.0.registered = true
deployment.javaws.version = javaws-1.4.2_01
deployment.system.cacerts = C:\PROGRA~1\JAVA\J2RE14~1.2_0\lib\security\cacerts
deployment.system.home = C:\WINDOWS\Sun\Java\Deployment
deployment.system.jssecacerts = C:\PROGRA~1\JAVA\J2RE14~1.2_0\lib\security\cacerts
deployment.system.profile = C:\WINDOWS
deployment.system.security.policy = file:/C:/WINDOWS/Sun/Java/Deployment/security/java.policy
deployment.user.cachedir = C:\WINDOWS\Application Data\Sun\Java\Deployment\cache
deployment.user.certs = C:\WINDOWS\Application Data\Sun\Java\Deployment\security\deployment.certs
deployment.user.extdir = C:\WINDOWS\Application Data\Sun\Java\Deployment\ext
deployment.user.home = C:\WINDOWS\Application Data\Sun\Java\Deployment
deployment.user.jssecerts = C:\WINDOWS\Application Data\Sun\Java\Deployment\security\deployment.jssecerts
deployment.user.logdir = C:\WINDOWS\Application Data\Sun\Java\Deployment\log
deployment.user.profile = C:\WINDOWS\Application Data
deployment.user.security.policy = file:/C:/WINDOWS/Application%20Data/Sun/Java/Deployment/security/java.policy
deployment.user.tmpdir = C:\WINDOWS\Application Data\Sun\Java\Deployment\cache\tmp
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator = \
file.separator.applet = true
http.agent = Mozilla/4.0 (Windows Me 4.90)
http.auth.serializeRequests = true
https.protocols = SSLv3,SSLv2Hello
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = C:\PROGRA~1\JAVA\J2RE14~1.2_0\classes
java.class.version = 48.0
java.class.version.applet = true
java.endorsed.dirs = C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\endorsed
java.ext.dirs = C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\ext
java.home = C:\PROGRA~1\JAVA\J2RE14~1.2_0
java.io.tmpdir = C:\WINDOWS\TEMP\
java.library.path = D:\PROGRAM FILES\INTERNET EXPLORER 6;.;C:\WINDOWS\SYSTEM;C:\WINDOWS;D:\PROGRA~1\INTERN~1;;C:\WINDOWS;C:\WINDOWS\COMMAND
java.protocol.handler.pkgs = sun.plugin.net.protocol|sun.plugin.net.protocol
java.runtime.name = Java(TM) 2 Runtime Environment, Standard Edition
java.runtime.version = 1.4.2_01-b06
java.specification.name = Java Platform API Specification
java.specification.vendor = Sun Microsystems Inc.
java.specification.version = 1.4
java.util.prefs.PreferencesFactory = java.util.prefs.WindowsPreferencesFactory
java.vendor = Sun Microsystems Inc.
java.vendor.applet = true
java.vendor.url = http://java.sun.com/
java.vendor.url.applet = true
java.vendor.url.bug = http://java.sun.com/cgi-bin/bugreport.cgi
java.version = 1.4.2_01
java.version.applet = true
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) Client VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Sun Microsystems Inc.
java.vm.specification.version = 1.0
java.vm.vendor = Sun Microsystems Inc.
java.vm.version = 1.4.2_01-b06
javaplugin.maxHeapSize = 96m
javaplugin.nodotversion = 142_01
javaplugin.proxy.config.list = http=proxy,https=proxy,ftp=proxy,gopher=proxy
javaplugin.proxy.config.type = manual
javaplugin.version = 1.4.2_01
javaplugin.vm.options = -Djava.class.path=C:\PROGRA~1\JAVA\J2RE14~1.2_0\classes -Xbootclasspath/a:C:\PROGRA~1\JAVA\J2RE14~1.2_0\lib\plugin.jar -Xmx96m -Djavaplugin.maxHeapSize=96m -Xverify:remote -Djavaplugin.version=1.4.2_01 -Djavaplugin.nodotversion=142_01 -Dbrowser=sun.plugin -DtrustProxy=true -Dapplication.home=C:\PROGRA~1\JAVA\J2RE14~1.2_0 -Djava.protocol.handler.pkgs=sun.plugin.net.protocol
line.separator = \r\n
line.separator.applet = true
os.arch = x86
os.arch.applet = true
os.name = Windows Me
os.name.applet = true
os.version = 4.90
os.version.applet = true
package.restrict.access.netscape = false
package.restrict.access.sun = true
package.restrict.definition.java = true
package.restrict.definition.netscape = true
package.restrict.definition.sun = true
path.separator = ;
path.separator.applet = true
sun.arch.data.model = 32
sun.boot.class.path = C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\rt.jar;C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\i18n.jar;C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\sunrsasign.jar;C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\jsse.jar;C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\jce.jar;C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\lib\charsets.jar;C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\classes;C:\PROGRA~1\JAVA\J2RE14~1.2_0\lib\plugin.jar
sun.boot.library.path = C:\PROGRAM FILES\JAVA\J2RE1.4.2_01\bin
sun.cpu.endian = little
sun.cpu.isalist = pentium i486 i386
sun.io.unicode.encoding = UnicodeLittle
sun.java2d.fontpath =
sun.net.client.defaultConnectTimeout = 120000
sun.os.patch.level =
trustProxy = true
user.country = US
user.dir = C:\WINDOWS\Desktop
user.home = C:\WINDOWS
user.language = en
user.name = Michael G. Coucke
user.timezone =
user.variant =
Done.
Dump classloader list ...
codebase=http://kraken.lowell.edu/, key=http://kraken.lowell.edu/,IONJava/classes/ion_16.jar,IONJava/classes/LP.jar, zombie=false, cache=true, refcount=1, info=sun.plugin.ClassLoaderInfo@109de5b
Done.
Dump thread list ...
Group main,ac=11,agc=2,pri=10
main,5,alive
AWT-Windows,6,alive,dameon
AWT-Shutdown,5,alive
Java2D Disposer,10,alive,dameon
AWT-EventQueue-0,6,alive
Group Plugin Thread Group,ac=3,agc=0,pri=10
Main Console Writer,6,alive
AWT-EventQueue-1,6,alive
TimerQueue,5,alive,dameon
Group http://kraken.lowell.edu/-threadGroup,ac=2,agc=0,pri=4
thread applet-LPRemote.class,4,alive
AWT-EventQueue-2,4,alive
Done.
I'm not a Java expert, so this may be more information than you ever wanted to see.
Once again, I hope that you can help. My experience has been that I usually have some obscure option set incorrectly and that causes me great grief.
Thanks fo your help,
Mike Coucke
[email protected]
----- Original Message -----
From: "Jeffrey Hall" <[email protected]>
To: "'Mike Coucke'" <[email protected]>
Sent: Thursday, September 04, 2003 11:48 AM
Subject: RE: Registration with Lowell Education Online
Hi Mike,
Try it now. I think this problem has arisen because Sun just
released a new version of the Plug-in (1.4.2), and when we released the
public beta of LOPARC, only one relevant version (1.4.0) was available
and the LOPARC code was written to look for that by default. I have
just recoded the relevant routines so they should now cause your browser
to simply pick up the latest 1.4 version of the Plug-in you have
installed, whatever it is. I "broke" Java on my machine to replicate
your problem, and the code I inserted today did fix it. Hopefully it
will have the same effect for you. I am running IE 6 and plugin
1.4.2_01 (as accessed via Tools->Sun Java Console).
One broader problem: some (non-LOPARC-specific) users on the Sun
forums have reported the "JRE collision" you are seeing when multiple
versions of the Plug-in are installed on the same machine. So if the
fix I made to our code doesn't work, one option would be to uninstall
all Java components from your computer and do a fresh install of the
latest runtime environment.
Let me know how/if this works. Thanks for the feedback and for your
patience.
Best regards,
Jeff Hall
Lowell Observatory
-----Original Message-----
From: Mike Coucke [mailto:[email protected]]
Sent: Wednesday, September 03, 2003 6:30 PM
To: [email protected]
Subject: Re: Registration with Lowell Education Online
Hello Jeff:
So far, I have been unable to launch a LOPARC session. I repeatedly
get the following error message:
"Exception: java.lang.ClassNotFoundException: LPRemote.class"
My browser is MS Internet Explorer version 6.0.2800.1106 Initially I was
using Java Plug-In version 1.4.1 and received the error message. I went
to the Sun website and downloaded/installed Java Plug-In version 1.4.2
and still get the message.
Before I try to launch LOPARC, I can select Tools->Sun Java Console from
IE's pull down menu to check my Java Plug-In version. When I try to
launch LOPARC, I get the following message:
"Applet(s) in this HTML page requires a version of Java different from
the one the browser is currently using. In order to run the applet(s)
in this HTML page, a new browser session is required, press 'Yes' to
start a new browser session." If I select 'No', I get the following
message: "Java Plug-in detected JRE collission"
If I select 'Yes', a new browser window opens and then I get the first
message above.
Can you help?
Mike Coucke
[email protected]
----- Original Message -----
From: <[email protected]>
To: <[email protected]>
Sent: Monday, September 01, 2003 5:30 PM
Subject: Registration with Lowell Education Online
September 1, 2003
Dear Michael Coucke:
Thank you for registering with Lowell Observatory's online education
site. We hope you enjoy using it and visit regularly as we continue to
expand its features and capabilities. This is a one-time welcoming
email.
For your records, your user ID is xxxxx, and your password is #########.
You'll need to supply these each time you log in.
This site gives you access to research-grade equipment including a 16"
telescope, CCD detector, and image processing software. Our online
archive of data is now available 24/7. The telescope will be opening to
our onsite users in May, and on select nights to the Internet at large
in June.
We have designed this site so you don't need a huge monitor or a
supercomputer to use it. All pages are viewable on screens running at
800x600 resolution or higher. To use LOPARC, you'll need a Java-enabled
browser with the Java 1.4 plug-in installed. If you don't have the
plug-in, you'll be prompted to download it the first time you attempt to
connect. This is an admittedly large (9 MB) but one-time-only download.
This site works correctly under Internet Explorer version 5 or higher.
If you use Netscape, you must be running version 6 or higher, and
display or applet behavior anomalies may occur.
If at any time you can't connect to our server, simply try again later.
We do experience several power outages each year, particularly during
Flagstaff's summer thunderstorm season. Our server is fully protected
and backed up, and can be quickly brought back on line, but any active
user sessions will be lost. Thanks for your patience during these
inevitable downtimes.
Your questions, comments, suggestions, and bug reports about this site
are always welcome. On behalf of the LOPARC development team, thanks
for signing up!
Jeffrey Hall
Assistant Research Scientist
Associate Director, Education and Special Programs
Lowell Observatory
Flagstaff, ArizonaHi Mike,
I see this in your logs:
Java(TM) Plug-in: Version 1.4.2_01
Using JRE version 1.4.2_01 Java HotSpot(TM) Client VM
User home directory = C:\WINDOWS
Proxy Configuration: Manual Configuration
Proxy: http=proxy,https=proxy,ftp=proxy,gopher=proxy
Proxy Overrides:
I just helped my Dad set up his computer with a new
cable modem, and had the situation where we couldn't
access any secure Web sites. The cable folks had us
disable the proxy. It looks like the error message is
saying it can't find your proxy server, and the logs
you posted say that you've decided to configure your
proxy manually, rather than using the settings from
IE (which is how mine is set up in the plugin
control panel.)
Could that be the problem?
--Steve -
I am trying to use and education program that needs Java applets and it will not run on Safari. IE will not install from the web. How do I get a browser that will work to install so I can use this program when I travel.
Try using FireFox. IE will only run on a Mac if you run Windows on the Mac.
Windows on Intel Macs
There are presently several alternatives for running Windows on Intel Macs.
Install the Apple Boot Camp software. Purchase Windows 7 or Windows 8. Follow instructions in the Boot Camp documentation on installation of Boot Camp, creating Driver CD, and installing Windows. Boot Camp enables you to boot the computer into OS X or Windows.
Parallels Desktop for Mac and Windows XP, Vista Business, Vista Ultimate, or Windows 7. Parallels is software virtualization that enables running Windows concurrently with OS X.
VM Fusion and Windows XP, Vista Business, Vista Ultimate, or Windows 7. VM Fusion is software virtualization that enables running Windows concurrently with OS X.
CrossOver which enables running many Windows applications without having to install Windows. The Windows applications can run concurrently with OS X.
VirtualBox is a new Open Source freeware virtual machine such as VM Fusion and Parallels that was developed by Solaris. It is not as fully developed for the Mac as Parallels and VM Fusion.
Note that Parallels and VM Fusion can also run other operating systems such as Linux, Unix, OS/2, Solaris, etc. There are performance differences between dual-boot systems and virtualization. The latter tend to be a little slower (not much) and do not provide the video performance of the dual-boot system. See MacTech.com's Virtualization Benchmarking for comparisons of Boot Camp, Parallels, and VM Fusion. A more recent comparison of Parallels, VM Fusion, and Virtual Box is found at Virtualization Benchmarks- Parallels 10 vs. Fusion 7 vs. VirtualBox. Boot Camp is only available with Leopard and later. Except for Crossover and a couple of similar alternatives like DarWine you must have a valid installer disc for Windows.
You must also have an internal optical drive for installing Windows. Windows cannot be installed from an external optical drive. -
Applets and memory not being released by Java Plug-in
Hi.
I am experiencing a strange memory-management behavior of the Java Plug-in with Java Applets. The Java Plug-in seems not to release memory allocated for non-static member variables of the applet-derived class upon destroy() of the applet itself.
I have built a simple "TestMemory" applet, which allocates a 55-megabytes byte array upon init(). The byte array is a non-static member of the applet-derived class. With the standard Java Plug In configuration (64 MB of max JVM heap space), this applet executes correctly the first time, but it throws an OutOfMemoryException when pressing the "Reload / Refresh" browser button or if pressing the "Back" and then the "Forward" browser buttons. In my opionion, this is not an expected behavior. When the applet is destroyed, the non-static byte array member should be automatically invalidated and recollected. Isn't it?
Here is the complete applet code:
// ===================================================
import java.awt.*;
import javax.swing.*;
public class TestMemory extends JApplet
private JLabel label = null;
private byte[] testArray = null;
// Construct the applet
public TestMemory()
// Initialize the applet
public void init()
try
// Initialize the applet's GUI
guiInit();
// Instantiate a 55 MB array
// WARNING: with the standard Java Plug-in configuration (i.e., 64 MB of
// max JVM heap space) the following line of code runs fine the FIRST time the
// applet is executed. Then, if I press the "Back" button on the web browser,
// then press "Forward", an OutOfMemoryException is thrown. The same result
// is obtained by pressing the "Reload / Refresh" browser button.
// NOTE: the OutOfMemoryException is not thrown if I add "testArray = null;"
// to the destroy() applet method.
testArray = new byte[55 * 1024 * 1024];
// Do something on the array...
for (int i = 0; i < testArray.length; i++)
testArray[i] = 1;
System.out.println("Test Array Initialized!");
catch (Exception e)
e.printStackTrace();
// Component initialization
private void guiInit() throws Exception
setSize(new Dimension(400, 300));
getContentPane().setLayout(new BorderLayout());
label = new JLabel("Test Memory Applet");
getContentPane().add(label, BorderLayout.CENTER);
// Start the applet
public void start()
// Do nothing
// Stop the applet
public void stop()
// Do nothing
// Destroy the applet
public void destroy()
// If the line below is uncommented, the OutOfMemoryException is NOT thrown
// testArray = null;
//Get Applet information
public String getAppletInfo()
return "Test Memory Applet";
// ===================================================Everything works fine if I set the byte array to "null" upon destroy(), but does this mean that I have to manually set to null all applet's member variables upon destroy()? I believe this should not be a requirement for non-static members...
I am able to reproduce this problem on the following PC configurations:
* Windows XP, both JRE v1.6.0 and JRE v1.5.0_11, both with MSIE and with Firefox
* Linux (Sun Java Desktop), JRE v1.6.0, Mozilla browser
* Mac OS X v10.4, JRE v1.5.0_06, Safari browser
Your comments would be really appreciated.
Thank you in advance for your feedback.
Regards,
Marco.Hi Marco,
my guess as to why JPI would keep references around, if it does keep them, is that it propably is an implementation side effect. A lot of things are cached in the name of performance and it is easy to leave things laying around in your cache. Maybe the page with the associated images/applets is kept in the browser cache untill the browser needs some memory and if the browser memory manager is not co-operating with the JPI/JVM memory manager the browser is not out of memory, thus not releasing its caches but the JVM may be out of memory. Thus the browser indirectly keeps the reference that it realy does not need. This reference could be inderect through some 'applet context' or what ever the browser uses to interact with JPI, don't realy know any of these details, just imaging what must/could be going on there. Browser are amazingly complicated beast.
This behaviour that you are observing, weather the origin is something like I speculated or not, is not nice but I would not expect it to be fixed even if you filed a bug report. I guess we are left with relleasing all significatn memory structures in destroy. A simple way to code this is not to store anything in the member fields of the applet but in a separate class; then one has to do is to null that one reference from the applet to that class in the destroy method and everything will be relased when necessary. This way it is not easy to forget to release things.
Hey, here is a simple, imaginary, way in which the browser could cause this problem:
The browser, of course needs a reference to the applet, call it m_Applet here. Presume the following helper function:
Applet instantiateAndInit(Class appletClass) {
Applet applet=appletClass.newInstance();
applet.init();
return applet;
When the browser sees the applet tag it instantiates and inits the new applet as follows:
m_Applet=instantiateAndInit(appletClass);
As you can readily see, the second time the instantiation occurs, the m_Applet holds the reference to the old applet until after the new instance is created and initlized. This would not cause a memory leak but would require that twice the memory needed by the applet would be required to prevent OutOfMemory.I guess it is not fair to call this sort of thing a bug but it is questionable design.In real life this is propably not this blatant, but could happen You could try, if you like, by allocating less than 32 Megs in your init. If you then do not run out of memory it is an indication that there are at most two instances of your applet around and thus it could well be someting like I've speculated here.
br Kusti -
Problem with java applet and array of arrays
hi!
i'm passing an array of arrays from java applet using
JSObject.getWindow(applet).call("jsFunction", array(array(), array()) );
in every other browser than safari 4.0.2 it's no problem to iterate over this array. in safari "array.length" is undefined. is such construction supported in safari's js engine?
Message was edited by: quaintpl
Message was edited by: quaintpl
Message was edited by: quaintpl
Message was edited by: quaintpl
Message was edited by: quaintplThanks for the answer but the problem is the type of object of method and how from pl/sql is posiblle to call.
The method waiting a ArrayofAlicIva, but if i define this object is not posible to set the object inside the array because the wsdl not have this functions.
I need to define array of objects but the object is inside is the diferent type of array.
If i Define the array of object correct to object inside, the method expect that the other array type.
Is a Deadlock ??
The solution in Java is Simple
AlicIva[] alicIva = new AlicIva[1];
alicIva[0]= new AlicIva();
alicIva[0].setId(Short.parseShort(1));
fedr[0].setIva(alicIva);
this is the method imported in java class to form
-- Method: setIva (LArrayOfAlicIva;)V
PROCEDURE setIva(
obj ORA_JAVA.JOBJECT,
a0 ORA_JAVA.JOBJECT) IS
BEGIN
args := JNI.CREATE_ARG_LIST(1);
JNI.ADD_OBJECT_ARG(args, a0, 'ArrayOfAlicIva');
JNI.CALL_VOID_METHOD(FALSE, obj, 'FECAEDetRequest', 'setIva', '(LArrayOfAlicIva;)V', args);
END;
Maybe you are looking for
-
OS X 10.8.2 - Disk I/O error triggered by Adobe Application Manager
Hi all, I've been experienceing some issues wince updating from 10.8.1 to 10.8.2 when using Adobe Creative Suite CS5.5 and CS6. Since going onto 10.8.2, everytime I launch Adobe Application Manager to perfom updates and manage my installation my MacB
-
Spool is not generating for deleted line item in PO.
Hi Experts, A PO which was created in SRM pushed into SAP environment and when it was created initially spool was generated and user was able to take the print out. But if he delete a linte item no spool is created and message log was saying there is
-
Hi Sapients, Here we are using 6.0 version.In that cheque printing is not possible. I think Standard forms are wrong.So can any body plz tell me the standard forms for Payment Advice ( in Paying Co.cd) - I used F110_D_AVIS Payment medium P
-
Why question marks instead of pics and links
When I upload my iWeb page ti iPage the pics and links show up as question marks and the text is not sized as it was on the iWeb page. Is iWeb not compatible with iPage? Thanks
-
Calendar input help blinking on popup window
Hi experts, I have strange behavior of input field with data element of type DATS assigned. Field is on popup window and when I try to pick a date value calendar input help blinks and hide, so it is not possible to pick a value. Any ideas why? Thank