Starting an Java-Applet with https
Is it possible to start a java-applet
from a secure web-page?
https://..../applet.html
If yes - HOW?
null
My code looks something like this
StringBuffer queryString = new StringBuffer(Applet.getCodeBase().toString());
// append all the variables I need here
URL dataUrl = new URL(queryString.toString());
BufferedReader br = new BufferedReader(new InputStreamReader(dataUrl.openStream()));This works from both http and https The protocol is the same as the how the page itself was loaded.
Similar Messages
-
Starting a Java applet???
I want to start a Java applet with this one JAR file I have. What is the code I need to put into the HTML to initiate the applet. I have this so far, but I don't know the class required:
<applet code = "whatclassdoineedhere.class"
archive = "file.jar"
width=256 height=256>
</applet>
I am wondering what class I need to get it running. I'm completely new to Java, and am just experimenting with some things.Let me know if it doesn't work, by the way, I suggest you to use the Object Tag like this, it makes the user behind the internet terminal, know if it has the Java Plug-in; if not, it tries to install it, like when using flash.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>MyAppletSigned</TITLE>
</HEAD>
<BODY topmargin='0' leftmargin='0' rightmargin='0' bottommargin='0' BGCOLOR='black'>
<OBJECT classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93'
codebase='http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0'
width='100%'
height='95%'>
<PARAM name='code' value='MyApplet.class'>
<PARAM name='codebase' value=''>
<PARAM name='archive' value='MyJar.jar'>
<PARAM name='type' value='application/x-java-applet;version=1.4'>
<PARAM name='scriptable' value='false'>
<COMMENT>
<EMBED type='application/x-java-applet;jpi-version=1.4'
width='100%'
height='95%'
code='MyApplet.class'
codebase=''
archive='MyJar.jar'
scriptable='false'
pluginspage='http://java.sun.com/j2se/1.4/index.html'>
<NOEMBED>
</NOEMBED>
</EMBED>
</COMMENT>
<P>
You don't have Java 2 SDK, Standard Edition v 1.4
</OBJECT>
</BODY>
</HTML> -
How to start java applet with netbeans 6.1
hey,
I want to learn how to start java applet (with database) with netbeans.. I'm new to java...can you show me how can i start..if you have any doc about it can you send it to me..thank you..:)You really should be asking this NetBeans question at the NB site - these forums are for Java language topics, not NB support.
[http://www.netbeans.org/kb/61/web/applets.html]
Almost any NB question you have can be answered by either the NB web documentation or the NB program's Help. -
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 -
Firefox allows Java Applet with elevated permissions
I ended up with a virus on Friday when I selected "View" on an HTML attachment from the GMail web interface. The attachment started up java and proceeded to install the malware "Desktop Security 2010" and make changes to my system startup. I'm wondering how this happened and how to prevent it. My java security settings (Java Control Panel->Security->Certificates->Trusted Certificates) only lists Akamai Technologies and JavaFX as trusted certificates. Shouldn't that mean that I get prompted if any one else signs an applet that tries to run outside the sandbox? What else do I need to do to make sure that NO java applets run with elevated permissions?
I've disabled java via an add-in in the meantime, but what do I need to do to secure my browser properly?
== This happened ==
Just once or twice
== I selected "view" on a virus-infected email attachment in gmailХорошо. Am now able to enter Cyrillic font into my applet. HOWEVER, another issue remains: After pressing enter to process input, new window opens as expected with correct information displaying in window EXCEPT for drop-down menu bar that should display in green square of open window. http://www.lesbaileyev.com/Project/RFvstem.html I will open another suport question for this new development.
-
Security popup accessing applet with https
I have a website that serves everything over https. One of the things being served is an applet. I've found that just before the first request is made for the applet's .class files, I get a popup from the Java plug-in saying:
Warning - Security
The web site's certificate has been verified. Do you want to continue?
I'm not sure what this is trying to tell me, is this a problem or just a friendly message? I look at "More Information..." and it says that the cert being used was issued by a trusted company, and that it is valid.
I'm lead to believe that Java is just being nice and telling me that I'm interacting with a site that has a good certificate. My problem is this stupid popup is going to ruin my demo. I want to turn it off, or do whatever is necessary not to get it. I've gone through the various Java settings, and can't figure it out.
I do see that the second time I go to the site (after I clear the popup) I don't get a popup again. However, this doesn't help me because I'm generating certs on the fly, and every new one causes the popup to reappear.
Any ideas on what I can do? I see that I'm using JRE 1.5.0_09 as my Java Applet Runtime version.
Sander SmithBy default applets can't read files off the hard drive.
The easiest way to handle this is to put the images and other resources (such as properties files) in the same jar file as the classes, and then use Class.getResource or Class.getResourceAsStream to load them. -
How to get started on java applet client/server game?
Hi,
I've googled, but didn't find any useful information about creating java applet client/server game. I've followed the example of Client/Server Tic-Tac-Toe Using a Multithreaded Server in Java How to Program from Deitel, but I when I tried on Applet, my cliet doesn't communicate with the server at all. Any help to get started with Applet would be great. Thanks!well, i decided to put in portion of my codes to see if anyone can help me out. the problem I have here is the function excute() never gets called. here is my coding, see if you can help. Notice, I'm running this on Applet thru html page. This shouldn't be much different than running JFrame in term of coding right?
Server.java
public void init()
runGame = Executors.newFixedThreadPool(2);
gameLock = new ReentrantLock();
otherPlayerConnected = gameLock.newCondition();
otherPlayerTurn = gameLock.newCondition();
players = new Player[2];
currentPlayer = Player1;
try
server = new ServerSocket(12345, 2);
catch (IOException ie)
stop();
message = "Server awaiting connections";
public void execute()
JOptionPane.showMessageDialog(null, "I'm about to execute!", "Testing", JOptionPane.PLAIN_MESSAGE);
for(int i = 0; i < players.length; i++)
try
players[i] = new Player(server.accept(), i);
runGame.execute(players);
catch (IOException ie)
stop();
gameLock.lock();
try
players[Player1].setSuspended(false);
otherPlayerConnected.signal();
finally
gameLock.unlock();
Client.java
public void init()
startClient();
public void startClient()
try
connection = new Socket(InetAddress.getByName(TienLenHost), 12345);
input = new Scanner(connection.getInputStream());
output = new Formatter(connection.getOutputStream());
catch (IOException ie)
stop();
ExecutorService worker = Executors.newFixedThreadPool(1);
worker.execute(this);
}So after worker.execute(this), it should go to Server.java and run the function execute() right? But in my case, it doesn't. If you know how to fix this, please let me know. Thanks! -
Unable to start the java applet
Hi there,
I'm having some problems with the java applet unable to display on some of the pc in the workplace. I've tried to uninstall & reinstall the jre but still to no avail.
Scenarios:
Log in as Administrator = OK
Log in as user with Administrator priviledge = NOT OK
Is there anything else which I could try? please advice & thanks so much guys.Not sure if this is the correct solution but to edit your classpath go to your start button and select settings. then from there select control panel. then select system and when you get the pop up menu select the advanced tab. you should see an environment variables button. when you select environment variables you will get another pop up menu. there should be a listing for classpath. select it and click edit.
start button -> settings -> control panel -> system -> advanced -> classpath
move your cursor to the end of the listing for your classpath and add whatever file or directory you need to add. then click ok. make sure you include the entire path and if you need to add a jar file also include the .jar extension. however, it may be enough that you include the path up to the directory where the jar is located.
once you add to your classpath, you will need to close and restart the application that needs the new classpath. -
How do you start a java program with more RAM alloaction
Hi
can anyone please tell me how to start a java program to start with lots of RAM (RAM size is sent as a parameter), I have seen it somewhere and now I cant remember it. I have a server application to run this way.
thanks and rgds
sunilsee the tooldocs of java: http://java.sun.com/j2se/1.4/docs/tooldocs/tools.html
-
How use to simple Java client with Https ?
Experts,
I am having some difficulties to call a https webservice on DataPower.
The following simple client has no problem to call HTTP webservice but HTTPs different story. SoapUI works just fine with Https request.
Can any one make a suggestion ? Appreciate any help !
public final static String DEFAULT_SERVER
= "https://123.123.123.123:443/Wsp";
// = "https://123.123.123.123:2048";
public final static String SOAP_ACTION
= "http://mycompany.com/Inquiry";
public static void main(String[] args) {
String server = DEFAULT_SERVER ;
String input1 = "123";
String input2 = "hello";
try {
URL u = new URL(server);
URLConnection uc = u.openConnection();
HttpURLConnection connection = (HttpURLConnection) uc;
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("SOAPAction", SOAP_ACTION);
OutputStream out = connection.getOutputStream();
Writer wout = new OutputStreamWriter(out);
wout.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
wout.write("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sam=\"http://aglc.com/sampleDp\">\r\n");
wout.write("<soapenv:Header/>\r\n");
wout.write("<soapenv:Body>\r\n");
wout.write("<sam:AcordRequest>\r\n");
wout.write("<sam:TRANSID>" + input1 + "</sam:TRANSID>\r\n");
wout.write("<sam:TRANSBODY>" + input2 + "</sam:TRANSBODY>\r\n");
wout.write("</sam:AcordRequest>\r\n");
wout.write("</soapenv:Body>\r\n");
wout.write("</soapenv:Envelope>\r\n");
wout.flush();
wout.close();
String hhResponse ="";
InputStreamReader isr = new InputStreamReader(connection.getInputStream());
BufferedReader in = new BufferedReader(isr);
String inputLine;
while ((inputLine = in.readLine()) != null){
//AIGTraceLog.log(componentName,Level.INFO,inputLine);
hhResponse = hhResponse+inputLine+"\n";
System.out.println(hhResponse);
in.close();
catch (IOException e) {
System.err.println(e);
}Thanks for the reply. I think I am close, based on your instruction, I did the following but still got the same error.
C:\Program Files\Java\j2re1.4.2_13>java com.mypack.testdpws.TestDPWS
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate not Trusted
C:\Program Files\Java\j2re1.4.2_13>keytool -import -alias testDPWS -file TestDpClSsl.crt
Enter keystore password:
Enter keystore password: password
Owner: CN=TestDpClSsl
Issuer: CN=TestDpClSsl
Serial number: 2dd2d12e
Valid from: 12/1/10 4:37 PM until: 12/1/11 4:37 PM
Certificate fingerprints:
MD5: 3A:89:FE:76:BC:30:BF:F0:87:31:F5:14:29:07:60:91
SHA1: 40:71:51:4C:84:BD:08:40:A6:7D:60:A8:A8:04:BA:09:B7:E5:C9:A4
Trust this certificate? [no]: y
Certificate was added to keystore
C:\Program Files\Java\j2re1.4.2_13>java com.mypack.testdpws.TestDPWS
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificate not Trusted
Any idea ? or do I need to add something in the test program ? -
Hi,
I have the problem to display the applet with AWT. If I am running the same applet in the internal server it works fine.If I am running through the web its giving Class not found exception.That web server also is mapped into the same server.
Here is the code.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
public class NotHelloWorldApplet extends Applet
public void init()
try{
setLayout(null);
Label label1= new Label("Hello World!");
label1.setSize(200,200);
add(label1);
}catch(Exception e){System.out.println(e);}
<html><body>
<applet
code="NotHelloWorldApplet"
codebase="."
width=600 height=400
>
</applet>
</body></html>
can anyone help me please.
ThanksHello,
Even I executed the program. Its works fine. I guess you must be having problem with the codebase. Just change the address in the codebase from current directory to the address where the class file is there and also change the permissions(set attributes to 755) of the class file. Hope this helps you.
Regards,
Sarada. -
import java.io.*;
import java.net.*;
import java.util.*;
import java.awt.*;
import java.applet.*;
public class Simple extends Applet {
TextArea text;
Socket _socket;
public void init(){
setLayout(null);
text = new TextArea("", 10, 10, TextArea.SCROLLBARS_VERTICAL_ONLY);
text.setBounds(10, 10, 350, 300);
text.setEditable(false);
add(text);
try {
_socket = new Socket("de.quakenet.org", 6667);
}catch(Exception e) { output(e.getMessage()); };
public void output(String s) {
text.append(s);
public void paint(Graphics g) {
It throws following exception:
access denied (java.net.SocketPermission de.quakenet.org resolve)
I've read, that Applet can only connect localy. But for example jIRC works also http://www.jpilot.com/java/irc/demo.html ...
How can I manage that?You get a java signing cert (like from Verysign) - when you sign the applet according to their instructions, it allows the end user to specify if your applet has rights or not, if they say yes, you would have the ability to connect to other servers.
If you want to avoid this problem, make your program an application instead of an applet. -
ASP code to start a Java program (with parameters)
Hi! All,
I am trying to write some ASP code which should start a java program. Does anybody know a simple way to do this? Am new to ASP
ThanksIt doesn't have anything to do with java.
Basically you need to make a system call which will start an external application. The external application can be anything including something like "java MyClass".
So either find an ASP forum/board/newsgroup to ask how to do a system call or read some docs on it. -
Hi all,
When i try to run more than one servelt of the Quick Start samples that using Livecycle Java APIs and i get an error of "Remote EJBObject lookup failed for ejb/Invocation provider" from any servelt i run.
I try some Quick samples which is not servelts (java class) and it works fine, which makes me sure that my connection properties is true.
Environment:
The LiveCycle is based on "Websphere v6.1", and i use "Eclipse Platform
Version: 3.4.1".
i install "tomcat 5.5.17" to test the servelts in developing time through Eclipse.(only for test in developing time not for deploy on )
The Jars i added in the classpath:
adobe-forms-client.jar
adobe-livecycle-client.jar
adobe-usermanager-client.jar
adobe-utilities.jar
ejb.jar
j2ee.jar
ecutlis.jar
com.ibm.ws.admin.client_6.1.0.jar
com.ibm.ws.webservices.thinclient_6.1.0.jar
server.jar
utlis.jar
wsexception.jar
My code is :
Properties ConnectionProps = new Properties();
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "iiop://localhost:2809");
ConnectionProps.setProperty ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_ EJB_PROTOCOL);
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE,ServiceClientFa ctoryProperties.DSC_WEBSPHERE_SERVER_TYPE);
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "Administrator");
ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
ConnectionProps.setProperty("java.naming.factory.initial", "com.ibm.ws.naming.util.WsnInitCtxFactory");
//Create a ServiceClientFactory object
ServiceClientFactory myFactory = ServiceClientFactory.createInstance(ConnectionProps);
//Create a FormsServiceClient object
FormsServiceClient formsClient = new FormsServiceClient(myFactory);
//Get Form data to pass to the processFormSubmission method
Document formData = new Document(req.getInputStream());
//Set run-time options
RenderOptionsSpec processSpec = new RenderOptionsSpec();
processSpec.setLocale("en_US");
//Invoke the processFormSubmission method
FormsResult formOut = formsClient.processFormSubmission(formData,"CONTENT_TYPE=application/pdf&CONTENT_TYPE=app lication/vnd.adobe.xdp+xml&CONTENT_TYPE=text/xml", "",processSpec);
List fileAttachments = formOut.getAttachments();
Iterator iter = fileAttachments.iterator();
int i = 0 ;
while (iter.hasNext()) {
Document file = (Document)iter.next();
file.copyToFile(new File("C:\\Adobe\\tempFile"+i+".jp i++;
short processState = formOut.getAction();
...... (To the end of the sample)
My Error was:
com.adobe.livecycle.formsservice.exception.ProcessFormSubmissionException: ALC-DSC-031-000: com.adobe.idp.dsc.net.DSCNamingException: Remote EJBObject lookup failed for ejb/Invocation provider
at com.adobe.livecycle.formsservice.client.FormsServiceClient.processFormSubmission(FormsSer viceClient.java:416)
at HandleData.doPost(HandleData.java:62)
at HandleData.doGet(HandleData.java:31)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
aI assume here that your application is deployed on a different physical machine of where LCES is deployed and running.
Do the following test:
- Say that LCES is deployed on machine1 and your application is deployed on machine2. Ping machine1 from machine2 and note the ip address.
- Ping machine1 from machine1 and note the ip address.
The two pings should match.
- Ping machine2 from machine1 and note the ip address.
- Ping machine2 from machine2 and note the ip address.
The two pings should match.
Usually this kind of error would happen if your servers have internal and external ip addresses. -
Exists some library to make HTTPS requests from an Applet? (or SSL)
ThanksYes. You have very poor English skills, I suggest you start to learn English when talking to mostly English individuals.
Some JRE's can use HTTPS. Use the HttpUrlConnection class.
Maybe you are looking for
-
Artifacts in display with PSE-13
Downloaded and installed PSE 13. In the photo editor I am getting artifacts when layers are created and when I use the Navigator to show different sections of the photo. In navigator this shows up as red lines as above. In the main display the lines
-
Bose Sound Docks are no longer compatible with Apple iPhones or iPods?
When plugging my iPhone 4S or 5, or my iPod 3rd Gen or 7th Gen into my Bose Sound Dock, I recieve a message that reads, "This iPhone/iPod is not compatible with this accessory" and will not play stored music. Background Info: - The Bose Sound D
-
I am unable to upload pdf files.
I am unable to upload files to acrobat.com. I receive an error message that says 'Error: Adobe reader did not get a response from the server. Try again later or contact your system administrator.' I'm on the internet right now. AND I use to heave a
-
PDF conversion to Excel isn't working
I'm a new user in ExportPDF Trying to convert a pdf file to an excel file, but conversion comes back as an .xlsx file, which Excell says is not compatible. Tried renaming it to an .xls file, but this didn't help Any suggestions? Thanks!
-
Problem with the synchronization by Desktop Software (6.1.0.35)
Hi, i have a big problem with the synchronization by Desktop Software (6.1.0.35). When I installed DS i set to folder sync photos not as ... Documents / BlackBerry / photo (created by default), but i chose ... Documents / Pictures / Photos from the