| Applet startup error - simple question |
|
 |
Index ‹ java-programmer
|
- Previous
- 10
- 2 level RAMAt some it will be economic to create banks of say 10 gigabytes of
RAM. This ram will be slower than regular RAM, but won't lose its
value when the power is ostensibly off.
How will this be integrated into Java?
The Windows world will likely treat these as small disk drives. You
will be able to manually place important files there. Windows will
fill it with something useless like system recovery snapshots.
However, it could be used more cleverly.
1. as a cache, much like the old Univac 1106 migrated files between
various speeds of mass storage in order to keep the most commonly used
ones on the fastest devices. You might even, like the 1106 unify this
with backup, so all files got backed up to servers on the Internet, or
spilled there if the disk became full.
2. for large address spaces, to keep infrequently used objects. It
becomes like your swap file today.
3. something else.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 10
- Question on the flush methodAccording to Sun's web site, the flush method of the OutputStream object
does nothing.
So, what does actually happens when you call it?
At times I may see different behavior when including it within a program
(some times a socket read error) which I would think is strange esspecially
if the method is not supposed to do anything.
Any ideas?
- 10
- java.lang.OutOfMemory ErrorI had used StringBuffer, as with 'out.println()' I will have to use +
operator for all the concatenation which I thought won't be that
efficient as using the StringBuffer.
- 10
- Java server performance - jeetyHi All,
I am working on an application where a servlet need to handle min 600
request / sec(which will keep on increasing in future)
So I am not able to decide which application server I should use.
As I go through some benchmarks I came to know that Jetty's performance
is better but
I don't know how much load it can handle.
Is there any who has used Jetty on heavy traffic application?
or is there any another servlet container / HTTP Server which can
handle such a load
Plz suggest me.
Thanks in Advance.
Rajiv Girdhar
- 10
- SPOT smart sensorsFor anyone interested in these but could never get the willpower to
learn embedded C or somesuch arcane language, these kits from Sun just
came out:
http://www.sunspotworld.com/products/
Some info:
http://www.sunspotworld.com/docs/
I had tinkered around with these typrs of objects before, but having
the thing programmable in Java makes the entire thing easier on my
end :-)
- 10
- 12
- Java program helpHello everyone, I need your help.. can you check why did i commit an
error on the n=System.read("enter numer:"); part...? Thanks in
advance...
By the way, the program will run as follows:
the user will input a number, and the program will generate the
fibonacci series based on the number. if example user input is 4,
there should be four series of fibonacci...:)
public class fibonacci
{
public static void main(String args[])
{
int prev1 = 1, prev2 = 1, current = 1;int n;
n = System.read("enter number: ");
for (int i = 3; i <= n; i++)
{
current += prev2;
prev2 = prev1;
prev1 = current;
System.out.println(" " + current);
}
}
}
- 12
- Is this syntactically valid Java?Is the following syntactically valid?
public class Foo {
public static void main(String[] args) {
for( foo: ; ; ); // Note statement label
}
}
javac is rejecting this, but IntelliJ is saying that it is valid. I
would appreciate a reference to the JLS if possible, so I can file a
bug report either with Sun or with JetBrains.
--
C. Benson Manica | I appreciate all corrections, polite or otherwise.
cbmanica(at)gmail.com |
----------------------| I do not currently read any posts posted through
sdf.lonestar.org | Google groups, due to rampant unchecked spam.
- 12
- ports/77656: java/jdk15 - (AMD64) install problem.Synopsis: java/jdk15 - (AMD64) install problem.
State-Changed-From-To: open->feedback
State-Changed-By: linimon
State-Changed-When: Fri Mar 31 08:53:35 UTC 2006
State-Changed-Why:
Submitter: is this still a problem?
Responsible-Changed-From-To: phantom->freebsd-java
Responsible-Changed-By: linimon
Responsible-Changed-When: Fri Mar 31 08:53:35 UTC 2006
Responsible-Changed-Why:
Reassign from phantom since he has been inactive for more than one year.
Hat: gnats-admin
http://www.freebsd.org/cgi/query-pr.cgi?pr=77656
- 12
- internet address vs lanI am about to create a RPC program and I need a servlet to talk to a
server. The servlet is running on the internet, the server is running
on a lan computer. I am pretty sure that the lan ip address is behind
our firewall. Can I still communicate with the server through RPC.
Berlin Brown
email***@***.com
this question sounds confusing, doesnt it?
- 12
- java.nio problemI had a NIO problem.
I tried to open a socket channel, and grep a HTML page from HTTP GET.
I did it success if I open and close socket channel everytime I send a
request and get the response.
However, if I keep open the socket channel and send multiple requests,
I'll get IOException.
Does anybody know how to solve this problem? Thanks in advance!
Note: I don't want to fire requests in parallel but one by one
sample code:
=============================================================
private Charset charset = Charset.forName("ISO-8859-1");
private SocketChannel channel;
try
{
// do connection
InetSocketAddress socketAddress =
new InetSocketAddress( "www.mydomain.com", 80);
channel = SocketChannel.open(socketAddress);
// send request #1
channel.write(charset.encode("GET /page1.html HTTP/1.0\r\n\r\n") );
// read response #1
ByteBuffer buffer = ByteBuffer.allocate(1024);
while ((channel.read(buffer)) != -1)
{
buffer.flip();
System.out.println(charset.decode(buffer));
buffer.clear();
}
// send request #2
channel.write(charset.encode("GET /page2.html HTTP/1.0\r\n\r\n") );
// read response #2
// program threw "java.io.IOException: Read failed" error
while ((channel.read(buffer)) != -1)
{
buffer.flip();
System.out.println(charset.decode(buffer));
buffer.clear();
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (channel != null)
{
try
{
channel.close();
} catch (IOException e) {}
}
}
=============================================================
- 15
- 15
- Array of generic List?Hello,
I am new to 1.5 and thus generics. I have read the generic tutorial and
a decent number of websites/newsgroup posts on the subject. But I still
cannot find a satisfactory solution to the following (as of now the
best I've got is an unchecked conversion warning)
The code below does not compile, but I think it shows to a human what I
want to accomplish. I can't seem to find the proper syntax and use of
generics to accomplish this without a warning. Any help and reasoning
why I need to do whatever the solution is would be great. Thanks.
public class MyClass {
private List<Foo>[] myFoos;
public MyClass() {
myFoos = new List<Foo>[5];
}
public void addFoo(int index, Foo foo) {
myFoos[index].add(foo);
}
}
- 16
- 16
|
| Author |
Message |
gdalevich

|
Posted: 2004-4-15 11:32:00 |
Top |
java-programmer, Applet startup error - simple question
Greetings!
I am running into a very strange problem with a very simple code
In my html page I have the following code:
<applet codebase="/" code="InterApplet" width="400" height="150"
name="InterApplet">
<param name="OutFrame" value="outFrame" valuetype="object">
no support for java
</applet>
When I load the page on Windows 2000 machine running IE6 it works fine
- applet loads. However, when I try to open this page on a Windows XP
machine also running IE6 it can't find the applet "load: class
InterApplet not found". I have my custom built web server so I could
actually see that the browser did make a request for InterApplet.class
and web server has served it.
So what in the world is happening?!? This is very frustrating.
I have not done any serious java programming since '97...
Thanks for your time.
|
| |
|
| |
 |
gdalevich

|
Posted: 2004-4-16 1:41:00 |
Top |
java-programmer >> Applet startup error - simple question
Roedy Green <email***@***.com> wrote in message news:<email***@***.com>...
> On 14 Apr 2004 20:31:49 -0700, email***@***.com (gtSasha) wrote
> or quoted :
>
> ><applet codebase="/" code="InterApplet" width="400" height="150"
>
> See http://mindprod.com/jgloss/applet.html
>
> My first rule is, put the Applet in a jar. This seems to make them an
> order of magnitude better behaved. It is much easier to track what is
> going on.
I've tried that, did not work. I've also tried specifying and not
specifying a .class extension, tried to put it (applet) into a
directory and specify path in different ways, nothing works. Man, ...
I wish I had a code to IE so I could debug this thing...
|
| |
|
| |
 |
gdalevich

|
Posted: 2004-4-16 11:12:00 |
Top |
java-programmer >> Applet startup error - simple question
Roedy Green <email***@***.com> wrote in message news:<email***@***.com>...
> On 15 Apr 2004 10:40:45 -0700, email***@***.com (gtSasha) wrote
> or quoted :
>
> >I've tried that, did not work. I've also tried specifying and not
> >specifying a .class extension, tried to put it (applet) into a
> >directory and specify path in different ways, nothing works. Man, ...
> >I wish I had a code to IE so I could debug this thing...
>
> Lets make sure you have Java properly installed. Go to
> http://mindprod.com/jgloss/wassup.html
> and look at what version of Java you have. The latest is 1.4.2_04.
> You may have some hopelessly old version 1.1 from MS.
>
> IF it too won't run, look at the console log for why. It may give us
> a clue.
Yes, that was the problem, thanks. If any one else is runs into a
similar issue there is a good description at
http://java.com/en/download/help/switchvm.jsp and
http://www.microsoft.com/mscorp/java/
|
| |
|
| |
 |
gdalevich

|
Posted: 2004-4-18 0:51:00 |
Top |
java-programmer >> Applet startup error - simple question
> Yes, that was the problem, thanks. If any one else is runs into a
> similar issue there is a good description at
> http://java.com/en/download/help/switchvm.jsp and
> http://www.microsoft.com/mscorp/java/
Even more detailed description is here:
http://java.sun.com/products/plugin/
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Stateless Session Beans and a Stateful Singleton? (Sharing dataI am interested in solving the same problem.
I currently have a solution involving JMX and WebLogic cluster.
1-create dynamic Mbean with synchronized methods
2-register with WL admin server as MBean agent/manager
3-all managed servers/users in cluster have access to this singleton
4-as clients log in/out they can invoke addUser/deleteUser methods on
dynamic mbean. They can also read currentUserCount.
PROBLEM:Single point of failure on admin server.
Looking for a simpler solution as you described above, OR
figuring out how to have dynamic MBean replicated in cluster so that each
managed server uses a local replicated copy--not sure how to achieve this
yet...
- 2
- Change look of disabled JButtonHello
How can I change the look of a disabled JButton? I have made a boardgame
with a brown background and brown buttons. I have also put an imageicon on
the buttons that has a colored image on it. When I disable the buttons, the
colored image is turned into grey which screws up the look of my game.
Can I change the grey color on a disabled button? Or do I have to keep it
enabled, and attach another imageicon with different color to show the user
he can't click the button?
Also, I can sometimes see a blue/gray line around my buttons. I want to get
rid of it, so I guess it has something to do with setBorder, but I can't
find it.
Thx,
Oswald
- 3
- storing SecretKey in keystorehi
i created a keystore as below
public static void makeKeyStore(){
try{
KeyStore ks=KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null,"".toCharArray());
FileOutputStream ksout=new FileOutputStream("myks.keystore");
char[] password = new char[] {'m','y','n','a','m','e'};
ks.store(ksout, password);
Arrays. fill(password, '\u0000' ) ;
}
catch(Exception e){
e.printStackTrace();
}
}
then i tried to store a generated key using an alias
public static void putEntriestoKS(){
try{
KeyStore ks=KeyStore.getInstance(KeyStore.getDefaultType());;
FileInputStream fin=new FileInputStream("myks.keystore");
char[] password = new char[] {'m','y','n','a','m','e'};
ks.load(fin,password);
FileOutputStream fout=new FileOutputStream("myks.keystore");
KeyGenerator kg=KeyGenerator.getInstance("AES");
SecretKey skey=kg.generateKey();
ks.setKeyEntry("mysecretkey", skey, password,null);
ks.store(fout,password);
Arrays.fill(password,'\u0000');
}
catch(Exception e){
e.printStackTrace();
}
}
when i run this i am getting a java.security.KeyStoreException: Cannot
store non-PrivateKeys
How then can i store SecretKey ?Do i have to use another provider?can
someone explain?
thanks
Jim
- 4
- CFP - IT Underground 2006, Prague, Czech RepublicHello,
I'd like to announce the call for papers for the IT Underground 2006, a
two-day conference organized by Software Conferences and hakin9.lab team in
23-24 February 2006, Prague, Czech Republic.
IT Underground 2006 is a fifth edition of a conference dedicated to IT
security issues, where remarkable authorities will share their knowledge and
experience with IT specialists.
In previous editions we had pleasure to listen to: Ofir Arkin, Maximillian
Dornseif, David h1kari Hulton, Chuck Willis, Charl Van der Walt, Shalom
Carmel, Martin Herfurt, Adam Laurie, Marcel Holtmann, Alexander Kornbrust,
Saumil Udayan Shah, Robert Lee Ayers, Dave Aitel, Stefano Zanero, Thorsten
Holz, Joanna Rutkowska, Michael Shema, Piotr Sobolewski, Michal Szymanski,
Paul Wouters, Rakan El-Khalil, Wojciech Dworakowski, K.K. Mookhey, Pawel
Krawczyk.
The dead line for lecture proposals is the 15th of January, 2006.
All the detailed information you can find on http://www.itUnderground.org/
We hope that you find our offer interesting. Please, contact me to discuss
further details of our cooperation.
IT Underground 2006 - basic characteristics.
When: 23-24 February 2006
Where: Prague, Czech Republic
Topic: IT Security
We assure:
- hotel accommodation and transfer,
- full support for your presentation, both before and during the conference,
- providing the necessary technical facilities for the presentation,
- assistance in acquiring and publishing presentation materials, information
about your lecture in the conference brochure,
- supervising and directing the overall progress of the conference.
--
Piotr Sobolewski
email***@***.com
- 5
- Problem with JDBC-ODBC connection to MS Access 2000I am trying to use JDBC-ODBC bridge to connect to a Access 2000
database on a Windows 2000 machine. I have set up
the database using the Data Sources utility in Windows 2000. I am
using the Java(TM) 2 SDK, Standard Edition
Version 1.4.2_01. The code snippet from an example I found is:
import java.sql.*;
import javax.swing.JOptionPane;
public class BookDB{
private static Connection connection;
private static Statement scrollStatement;
private static ResultSet books;
public static void connect() throws ClassNotFoundException,
SQLException {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:MurachBooks";
String user = "Admin";
String password = "";
connection = DriverManager.getConnection(url, user, password);
}
When I complie I get the following error:
BookDB.java [10:1] cannot resolve symbol
symbol : method forName (java.lang.String)
location: class Class
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
^
1 error
Errors compiling BookDB.
I have looked at all of the possible sources of information I can
think of to find an answer to my problem.
- 6
- Applet caching in IE5 - permanently!
I have the same problem and I posted the question a couple of weeks ago
but no one seemed to care or know what happened.
> -----Original Message-----
> From: email***@***.com (Dave) [SMTP:email***@***.com]
> Posted At: Wednesday, July 16, 2003 5:43 AM
> Posted To: comp.lang.java.programmer
> Conversation: Applet caching in IE5 - permanently!
> Subject: Applet caching in IE5 - permanently!
>
> IE seems to be caching applet classes forever. The 'CTRL-REFRESH'
> thing used to work (I've been doing that for years). But just recently
> (about 1 month ago), this stopped working. Deleting temporary files,
> restarting IE and even rebooting doesn't seem to flush the cache. I'm
> really confused - where could it be caching it?
>
> The only thing I can think of is that a 'Windows update' has installed
> an IE patch that has broken something.
>
> Has anyone else experienced this? Am I going mad?
- 7
- 8
- Cannot Find My API classThere goes the error:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 0 in the jsp file: /time.jsp
Generated servlet error:
[javac] Compiling 1 source file
F:\JAVA\TomCat41\work\Standalone\localhost\bigj\time_jsp.java:41:
cannot resolve symbol
symbol : class TimeFormatterBean
location: class org.apache.jsp.time_jsp
TimeFormatterBean formatter = null;
^
How can be seen, it cannot locate the TimeFormatterBean class. I've
placed my application in the dir:
%CATALINA_HOME%\webapps\bigj\
and the class in here:
%CATALINA_HOME%\webapps\bigj\WEB-INF\classes
so.. y dam it ain't working?
- 9
- 10
- Having issues with context listener and netbeansI'm new to netbeans and the whole JSP world in general (i have
experience in j2me and the j2se). I basically wanted to test out the
listener functions.
I get no errors with the following code, however, i'm also not able to
'break' where i want to be able to and I have no output as I would
expect. Any suggestions would be great.
MyHttpSessionListener.java
-------------------------------------------------------------
package com.maturitymodel;
import javax.servlet.http.HttpSessionListener;
import javax.servlet.http.HttpSessionEvent;
public class MyHttpSessionListener implements HttpSessionListener
{
public void sessionCreated(HttpSessionEvent e)
{
System.err.println("Hello new session");
}
public void sessionDestroyed(HttpSessionEvent e)
{
System.err.println("ByeBye old session");
}
}
---------------------------------------------------------------------------
web.xml
--------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<listener>
<listener-class>com.maturitymodel.MyHttpSessionListener</listener-class>
</listener>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config><session-timeout>
30
</session-timeout></session-config><welcome-file-list><welcome-file>
index.jsp
</welcome-file></welcome-file-list></web-app>
-----------------------------------------------------------------------
index.jsp
------------------------------------------------------------------------
<%@ page session="true"%>
- 11
- Client/Server chat program - wait for connectionHi,
I'm trying to modify a client/server chat program that connects
immediately, to wait till an IP address is selected from a combo box and
then connect when a connect button is pressed. The combo box is loaded
from a file of IP addresses and I select the localhost address of
127.0.0.1.
I've taken out the app.runClient line from the main class and made it
the actionPerformed when the connect button is pressed, but the client
side seems to go dead (won't accept any input) when I do this although
the connection seems to be working.
Any help appreciated.
// Client.java
// Set up a Client that will read information sent
// from a Server and display the information.
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Client3 extends JFrame
{ private JTextField enter;
private JTextArea display;
private JButton connect, send;
private JComboBox selectIp;
ObjectOutputStream output;
ObjectInputStream input;
String message = "", address = "";
public Client3()
{
super( "Client" );
Container c = getContentPane();
JPanel northPanel = new JPanel();
northPanel.setLayout( new GridLayout( 2, 1, 3, 3 ) );
// Enter field and action listener
enter = new JTextField();
enter.setEnabled( false );
enter.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e )
{
sendData( e.getActionCommand() );
}
}
);
northPanel.add( enter );
// Send button
send = new JButton("Send >");
send.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
sendBtn( e.getActionCommand() );
}
}
);
northPanel.add( send );
c.add( northPanel, BorderLayout.NORTH );
// Dislay area
display = new JTextArea();
c.add( new JScrollPane( display ),
BorderLayout.CENTER );
JPanel southPanel = new JPanel();
southPanel.setLayout( new GridLayout( 1, 2, 3, 3 ) );
// SelectIP combobox, listener and item listener
selectIp = new JComboBox();
selectIp.addItemListener(
new ItemListener() {
public void itemStateChanged( ItemEvent evt )
{
if( evt.getSource() == selectIp )
if( evt.getStateChange() == ItemEvent.SELECTED )
address = (String) evt.getItem();
}
} );
southPanel.add( selectIp );
// Read file and load into combobox
try
{
BufferedReader inBuffer = new BufferedReader( new
FileReader("ipaddress.txt") );
String line = inBuffer.readLine();
while( line != null )
{
selectIp.addItem( line );
line = inBuffer.readLine();
}
inBuffer.close();
}
catch(IOException e)
{ System.out.println(e);
}
// Connect button
connect = new JButton( "Connect");
connect.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e )
{
if( e.getSource() == connect )
{
runClient();
}
}
} );
southPanel.add( connect );
c.add( southPanel, BorderLayout.SOUTH );
setSize( 300, 300 );
show();
} // end Client constructor
public void runClient()
{ Socket client;
try {
// Step 1: Create a Socket to make connection.
display.setText( "Attempting connection\n" );
client = new Socket(
InetAddress.getByName( address ), 6000 );
display.setText( "Connected to: "+ address +
client.getInetAddress().getHostName() );
// Step 2: Get the input and output streams.
output = new ObjectOutputStream(
client.getOutputStream() );
output.flush();
input = new ObjectInputStream(
client.getInputStream() );
display.append( "\nGot I/O streams" );
// Step 3: Process connection.
enter.setEnabled( true );
do
{ try {
message = (String) input.readObject();
display.append( "\n" + message );
display.setCaretPosition(
display.getText().length() );
}
catch ( ClassNotFoundException cnfex ) {
display.append(
"\nUnknown object type received" );
}
} while ( !message.equals( "SERVER>>> quit" ));
// Step 4: Close connection.
display.append( "\nClosing connection.\n" );
output.close();
input.close();
client.close();
} // end try
catch ( EOFException eof ) {
System.out.println( "Server terminated connection" );
}
catch ( IOException e ) {
e.printStackTrace();
}
} // end runClient
// Action handler for Enter key
private void sendData( String s )
{
try {
message = s;
output.writeObject( "CLIENT>>> " + s );
output.flush();
display.append( "\nCLIENT>>>" + s );
}
catch ( IOException cnfex ) {
display.append(
"\nError writing object" );
}
} // end sendData
// Action handler for send button
private void sendBtn( String s )
{
try {
s = enter.getText();
output.writeObject( "SERVER>>> " + s );
output.flush();
display.append( "\nSERVER>>>" + s );
}
catch ( IOException cnfex ) {
display.append(
"\nError writing object" );
}
} // end sendBtn
// Main
public static void main( String args[] )
{
Client3 app = new Client3();
app.addWindowListener(
new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{ System.exit( 0 );
}
}
);
// app.runClient();
} // end main
} // end Client Class
// Server.java
// Set up a Server that will receive a connection
// from a client, send a string to the client,
// and close the connection.
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Server1 extends JFrame
{
private JTextField enter;
private JTextArea display;
ObjectOutputStream output;
ObjectInputStream input;
public Server1()
{
super( "Server" );
Container c = getContentPane();
enter = new JTextField();
enter.setEnabled( false );
enter.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
sendData( e.getActionCommand() );
}
}
);
c.add( enter, BorderLayout.NORTH );
display = new JTextArea();
c.add( new JScrollPane( display ),
BorderLayout.CENTER );
setSize( 300, 300 );
show();
} // end Server constructor
public void runServer()
{
ServerSocket server;
Socket connection;
int counter = 1, optionPane;
try {
// Create a ServerSocket.
server = new ServerSocket( 6000, 100 );
while ( true )
{
// Wait for a connection.
display.setText( "Waiting for connection\n" );
connection = server.accept();
display.append( "Connection " + counter +
" received from: " +
connection.getInetAddress().getHostName() );
// Set input and output streams.
output = new ObjectOutputStream(
connection.getOutputStream() );
output.flush();
input = new ObjectInputStream(
connection.getInputStream() );
display.append( "\nGot I/O streams\n" );
// Process connection.
String message =
"SERVER>>> Connection successful\n";
output.writeObject( message );
output.flush();
enter.setEnabled( true );
do {
try {
message = (String) input.readObject();
display.append( "\n" + message );
display.setCaretPosition(
display.getText().length() );
}
catch ( ClassNotFoundException cnfex ) {
display.append(
"\nUnknown object type received" );
}
if( message.equals( "CLIENT>>> TRANSFER FILE?" ) )
{
optionPane = JOptionPane.showConfirmDialog((Component)
null, "Do you want to accept the file transfer",
"File Transfer", JOptionPane.YES_NO_OPTION );
if( optionPane == JOptionPane.YES_NO_OPTION )
{
output.writeObject( "PRESS 'SEND FILE' BUTTON" );
output.flush();
display.append( "\nWAITING FOR FILE" );
}
else
{
output.writeObject( "NO - Do not send file" );
output.flush();
display.append( "\nNO - Do not send file" );
}
}
} while ( !message.equals( "CLIENT>>> quit" ) );
// Close connection.
display.append( "\nUser terminated connection" );
enter.setEnabled( false );
output.close();
input.close();
connection.close();
++counter;
} // end while
} // end try
catch ( EOFException eof ) {
System.out.println( "Client terminated connection" );
}
catch ( IOException io ) {
io.printStackTrace();
}
} // end runServer
private void sendData( String s )
{
try {
output.writeObject( "SERVER>>> " + s );
output.flush();
display.append( "\nSERVER>>>" + s );
}
catch ( IOException cnfex ) {
display.append(
"\nError writing object" );
}
} // end sendData
public static void main( String args[] )
{
Server1 app = new Server1();
app.addWindowListener(
new WindowAdapter()
{
public void windowClosing( WindowEvent e )
{ System.exit( 0 );
}
}
);
app.runServer();
} // end main
} // end Server Class
- 12
- JPanel doenst growHey, I am beginning Java Student with a Java Problem. I looked on the
Internet but didn't find my answer anywhere, maybe you guys could help ?
I have a:
JFRAME --> Container+GridBayLayout
Container+GridBayLayout --> JPanel options
--> JScrollpanel
JScrollpanel --> add(new RectangleGroup());
//A piece of the entire class RectangleGroup:
-------------------
public class RectangleGroup extends JPanel
{
public void paintComponent(Graphics g)
{
this.g = g;
super.paintComponent(g);
//A lot of THESE Things
g.drawRect(150,100,100,10);
}
}
-------------------
The problem is that I dont get a scrollbar when I draw a rectangle that is
out of sight in the browser.
A have uploaded a picture of it here:
http://www.denbreejen.net/public/School/dnaproject2/browser_problem.gif
Wouter
--
Message posted via http://www.javakb.com
- 13
- Writing and running files from a Java/AspectJ application.I'm creating an add-on to windows that will let me create files and run
basic functions such a image editing, both built in and on the hard
drive of a ftp server. If anyone could help me it would be wonderful.
I am planning to use the Eclispe SDK woth the AspectJ plugin. I have
the basic functions set up word editing but I need to know how to run
.exe files on the hard drive.
- 14
- why call cipher.getInstance(),throw below error?my source code is:
Security.addProvider(new BouncyCastleProvider());
Cipher cipher = Cipher.getInstance("RSA/NONE/PKCS1PADDING","BC");
when run it , cause below error,who can explain it,thanks in
advance.....
java.lang.ExceptionInInitializerError
at java.lang.Class.runStaticInitializers(Unknown Source)
at javax.crypto.Cipher.a(Unknown Source)
at javax.crypto.Cipher.getInstance(Unknown Source)
at
com.pioneer.bluray.security.authenticator.SignatureChecking.rsaDecrypt(Unknown
Source)
at
com.pioneer.bluray.security.authenticator.SignatureChecking.fetchSignature(Unknown
Source)
at
com.pioneer.bluray.security.authenticator.SignatureChecking.checkCredentialValues(Unknown
Source)
at
com.pioneer.bluray.security.authenticator.SignatureChecking.checkCredentials(Unknown
Source)
at
com.pioneer.bluray.security.authenticator.DVBSecUtils.invokeSecurity(Unknown
Source)
at org.dvb.lang.DVBClassLoader.securityCheck(Unknown Source)
at org.dvb.lang.DVBClassLoader.acquireData(Unknown Source)
at org.dvb.lang.DVBClassLoader.defineClassPrivileged(Unknown
Source)
at org.dvb.lang.DVBClassLoader.access$000(Unknown Source)
at org.dvb.lang.DVBClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at org.dvb.lang.DVBClassLoader.findClass(Unknown Source)
at org.dvb.lang.DVBClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.tv.Request.execReq(Unknown Source)
at com.sun.tv.XletRunnable$ExecThread.run(Unknown Source)
at java.lang.Thread.startup(Unknown Source)
Caused by: java.lang.SecurityException: Cannot set up certs for
trusted CAs
at javax.crypto.SunJCE_b.<clinit>(Unknown Source)
... 20 more
Caused by: java.lang.SecurityException: Jurisdiction policy files
are not signed by trusted signers!
at javax.crypto.SunJCE_b.f(Unknown Source)
at javax.crypto.SunJCE_b.e(Unknown Source)
at javax.crypto.SunJCE_s.run(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
at java.security.AccessController.doPrivileged(Unknown Source)
... 21 more
- 15
- Tomcat classpath and servlets outside of WEB-INFHi,
Does anybody know if it is possible to execute servlets outside the
WEB-INF directory? Somebody at work thinks that setting the classpath
would help. But I have had no luck so far. I'm currently on a
Win2000 box running Apache, Tomcat 4.1.18, j2sdk 1.4.2. And I found
out (to my dismay) that symbolic linking doesn't work with Windows. I
don't even know if symbolic linking would work if it was a linux box.
People at work say that Tomcat has worked and it was executing
servlets outside the WEB-INF directory. They are very sure on this
point. But it broke, and they decided to deleted the entire
installation (conf file and all). And the person who got it to work
is no longer here. So I'm at square one. Jserv had been running the
servlets, but the company wants to move forward. The servlets had
been mapped to Jserv through the classpath.
Any help or ideas would be greatly appreciated.
Jim
|
|
|