View Full Version : Urgent JApplet question
kyappel
01-24-2002, 12:44 PM
Hi.
I have Mac OS X and running IE 5.1. Some Swing applet from Sun's
swing examples page runs, some don't. I contacted Apple, and I was
told to reinstall the Java stuff again:<.
I tried using the APPLET tag in my HTML source to load a JApplet from a jar file, and nothing happens! Should there be some kind of alert or exceptions in the Java Messages box? The annoying part is that there is no feedback on if IE find the jar file or not...
How to verify if JVM is installed properly? I opened a terminal
prompt, and typed "env", there is no "$CLASSPATH" variable set in the
environment like in a NT machine. I looked at the
/System/Library/Java directory, the JavaConfig.plist has the following
contents:
{
Vendor = apple;
apple = {
VM = "/usr/bin/java";
DefaultClasspath =
"$HOME/Library/Java:$NEXT_ROOT/Library/Java:$NEXT_ROO
T/System/Library/Java:$NEXT_ROOT/Network/Library/Java:$NEXT_ROOT/System/Library/
Frameworks/JavaVM.framework/Classes/classes.jar:$NEXT_ROOT/System/Library/Framew
orks/JavaVM.framework/Classes/ui.jar";
DefaultBeanpath =
"$HOME/Library/JavaBeans:$NEXT_ROOT/Library/JavaBeans:
$NEXT_ROOT/System/Library/JavaBeans:$NEXT_ROOT/Network/Library/JavaBeans";
Compiler = "/usr/bin/javac";
Headers = "$NEXT_ROOT/System/Library/Frameworks/JavaVM.framework/Headers
";
Library = "$NEXT_ROOT/System/Library/Frameworks/JavaVM.framework/Librari
es/libjvm.dylib";
};
}
Then I tried to echo "$NEXT_ROOT", it is not defined. So it is very
confusing how this JVM actually works to find the library files. If
everything is installed properly, what should be the environment
values?
Thanks.
mervTormel
01-24-2002, 01:07 PM
it's important to note that a finder app, like IE, knows nothing about the terminal app's environment.
that the terminal env doesn't have the "$CLASSPATH" defined is a deficiency of the shell's startup scripts (?), or perhaps they are only around for an instance of command line java?
and that wouldn't fix IE, right?
as for IE's mindset, well, their implementation of java's always been spotty.
i wonder if something in IE's java prefs panel could be used.
does that help, or am i not understanding the issue?
DrJerph
01-24-2002, 07:17 PM
I just tried all Swing/JFC applets in the /Developer/Examples/Java dir, but they all work.
- As far as the classpath is concerned: this is not part of your problem. Java always has a default built-in classpath, that points to runtime-critical class-files (such as the Swing libraries)
- I think the $NEXT_ROOT variable refers to the root mount-point ("/") on the filesystem.
You can test if your JVM works by running a Jar-file. I'll take SwingSet2 as an example (you need to have installed the Developers tools CD):
1. open a terminal window
2. Type: cd /Developer/Examples/Java/JFC/SwingSet2.app/Contents/Resources/Java
3. Type: java -jar SwingSet2.jar
If everything looks OK, there's probally nothing wrong with the JVM. I'm not really sure on how IE uses the system JVM though. Maybe you should reinstall IE....
mervTormel
01-24-2002, 07:51 PM
% pwd
/Developer/Examples/Java/JFC/SwingSet2/SwingSet2.app/Contents/Resources/Java
% java -jar SwingSet2.jar
Failed to load Main-Class manifest attribute from
SwingSet2.jar
not too very good
not the same path as yours, but this is what i got for a path to that basename
DrJerph
01-25-2002, 04:01 AM
Sorry, I didn't test my own advice.
Problem is that to execute a Jar-file, it has to know which class is the main-class (this is found in the 'manifest.mf' file in the '****-INF' directory in the Jar-file (which is in turn a zip-file)).
Instead of: 'java -jar SwingSet2.jar'
try: 'java -classpath SwingSet2.jar SwingSet2'
A thousand humble apologies for my shameful mistake!! :o
DrJerph
01-25-2002, 04:04 AM
...an even simpler way to test the applet is to start the 'Applet Launcher' app (in '/Applications/Utilities') and open the 'SwingSet2.html' file (or any other HTML page with an applet)
kyappel
01-25-2002, 03:43 PM
Thanks for the responses. I verified the Java is installed OK. But there is problems with applet contacting server.
It is a Swing applet contacting servlets on web server on a PC through Https. On a PC's IE, the applet runs OK. But when running with IE5.1 on Mac OS X, there is an security exception in the Java console:
javax.net.ssl.SSLException: untrusted server cert chain
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.ClientHandshaker.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.Handshaker.process_record([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
at java.io.OutputStream.write(OutputStream.java:61)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.doConnect([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.NetworkClient.openServer([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.l([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpClient.<init>([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.<init>([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connect([DashoPro-V1.2-120198])
at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.getOutputStream([DashoPro-V1.2-12019
8])
at com.mycompany.streaming.applet.MyServerInterface.sendMessage(MyServerInterface.java:240)
at com.mycompany.streaming.applet.ConfigPropertiesManager.loadProperties(ConfigPropertiesManager.java:
118)
at MyContainerApplet.loadProperties(MyContainerApplet.java:234)
at MyContainerApplet.init(MyContainerApplet.java:92)
at sun.applet.AppletPanel.run(AppletPanel.java:358)
The Mac never prompted the user to accept a secure connection as I expected, it just throw up this exception.
What should the browser(IE 5.1) setting be for applet to send https requests?
So I changed the applet to make http connection request, it still doesn't work. The applet receives an encrypted session info object from the server at the start-up, then the applet sends request to server with this encrypted session info to authenticate its http requests. But the server insist the session info object got back is no longer the same as what it send to the applet. Therefore the applet can not authenticate itself and just throw a EOF exception after trying opeing the http connection for a while. This isn't happening on a PC's IE. What does Mac OS X's IE do differently? Does it append something to http requests?
Thank you.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.