janne jounivich

Ranch Hand
+ Follow
since Jan 11, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by janne jounivich

I have had good results with experimenting the following open source
project - JDesktop Integration Components (JDIC) project (https://jdic.dev.java.net/) and it is based on communication with user's default browser thus being able to understand DOM, javascript, css. JDIC component can easily be put inside Applet or java application.

Please check it out. You can find examples and code snippets from the above mentioned developer's page.

12 years ago
In my code, the actionPerformed kind of method when I am studying the boolean values of socket.isConnected() and socket.isBound(), both values are true but still out.println("xxx") and out.flush() don't write anything to a output stream. Wandering why? If those above mentioned variable values are true, according to my logic the socket connection should be active, alive and shouldn't I then be able to perform the writing successfully?

As for exceptions, I get NullPointerExceptions very seldomly (maybe 1/5) in that part of my code where I am writing text into PrintWriter object (like out.println("xxx");

Just wondering the following.

During the applet session ( from init() to stop() ) I want to
use the same socket connection and readers, writers created
upon it. Only when stop() or destroy() are invoked, only then
I want to close all streams.

Should I put all the creations of sockets and streams into init()
method? Or somewhere else?

What about if I wanna use over and over again the same socket and
output stream? If I have some actionPerformed kind of method in which I
want to write data into the stream, can't I basically just write to this with out.println("xxx"); out.flush();

What I want is that my socket and output readers should be persistence during the appelet session (from init to stop)? How to achieve this?

Hi Java experts,

I am desparate with my applet attempting to write some data into
a socket stream. Actually I am able to write once something into the socket but as soon as I am doing it the second time, the execution of the applets fails.

My scenario is the following. I have gotta a component placed inside JApplet. Certain actions are listened on this component. These actions trigger, fire up a process at the end of which some data is written into the socket stream. However something goes very wrong when the second action is triggered.

Here is my simplified code

public class className extends javax.swing.JApplet implements ComponentListener {
public void init(){
try {
} catch(Throwable thro){

//this method is triggered when user does certain
//actions on component
public boolean method_Trying_To_Write_To_Socket(String url,int query_length) {
try {
catch (Throwable tho) {
System.err.println("Throwable: " + tho);

public void stop(){

public void ConnectSocket(String server,int port) throws Throwable {
pe = new SocketPermission(server+":"+port,"connect,accept,resolve");
socket = new Socket(server, port);

public void OpenWriters() throws Throwable {
out = new PrintWriter(socket.getOutputStream(),true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));

public void CloseSocket() {
try {
} catch (Exception e){

I have gotta server implemented with Java listening to a certain port.

Could any of you help me out with what goes actually wrong? Why am I not able to write into the socket another time?
[ June 04, 2008: Message edited by: janne jounivich ]
Hi guys,

Was wondering if there was a way for any component in Java Applet to act a web browser. I am aware about the restrictions Applets are causing....network etc.

If you use f.eg JEditorPane in a standalone application, it is easy to set up the page with the desired URL and add hyperlinkListener to listen any actions. What would be the best and easiest way to achieve this goal using JApplet?

[ May 14, 2008: Message edited by: janne jounivich ]
12 years ago
Hi guys,

I have the following kind of scenario I am trying to achieve. I have a frame in which I have currently a JEditorPane component. This component has gotta a Hyperlink listener listening to hyperlink actions on various URL.

It works ok but this functionality is not enough for me. What I am achieving is I wanna my jEditorPane to listen to submit button clicks as well and thereby doing necessary actions. Is this possible with jEditorPane or should I use another component to achieve my goal?

Or maybe I should approach the problem differently? Is is possible to open another program (in my case browser) with the help of eg.
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + page);
inside Swing application?

I would appreciate any kind of help you can provide.

12 years ago
Hi Ulf,

In my client part of app in SocketHandler I am using

input = new BufferedReader(new InputStreamReader(cs.getInputStream(),"UTF-8"));
output = new PrintWriter(new OutputStreamWriter(cs.getOutputStream(),"UTF-8"));


in server part in ConnectionHandler I am using

input = new BufferedReader(new InputStreamReader(cs.getInputStream(),"UTF-8"));
output = new PrintWriter(new OutputStreamWriter(cs.getOutputStream(),"UTF-8"));

but still when debugging with the help of Java console, I get only
question marks instead of f.eg real characters. What could be the problem?

12 years ago
Would you mind if I send you my Java code? It would be probably easier for you to tell what's wrong with the code than copy/pasting just some portions of code?

In case of yes, which address could I send the code?

12 years ago

I am encountering the following kind of problem. I am trying to implement a chat applet that supports various languages such as korean, russian, chinese, japanese and scandinavian languages (characters �,�,�) etc.

The problem is that I am capable of producing text basically in any language (in a understable format so that on my own chat applet window everything gets outputted correctly) but others participating the chat aren't doing that. Instead of seeing real characters they see only question marks, ???.

What may be causing this?

Please help me out with this problem. I have already tested the following kind of approach like

String myUTF8=new String(Ed.getText().getBytes("ISO-8859-1"),"UTF-8")
but without success.

12 years ago
Hi guys,

I am wondering this is the right forum to post the description of what I would like my web app to be alike.

I am planning to create web app where users after they have logged in the app they would have possibility of following the browsing of other users. I would like the app to pop up a new window with contents of what the other user are seeing in their browsers.

I assume that this is possible to implement by means of socket(network) programming. But as being new to sockets, I appreciate if you guys could give me some hints and clues how to approach the topic!

Привет! Hi!

Thanks Mikalai for your excellent guide. Great job!


I would appreciate if I received the copy of the discussed material too.

My email address is

I see. Thank you for the info.
Thanks, Michael for your comments!

I am still wondering, pondering how much Head First EJB
actually covers EJB 3.0 related topics

Having as my goal to pass SCBCD 5.0 exam, can I
be confident that this one book is enough or is another
"opus" beside the Head First EJB needed, required?

Thanks in advance,
Hi guys,

It is time for the next certification (passed the SCWCD 1.4 in June) after a short "summer" break.

Just today I made a decision and commitment that the next certification would be SCBCD x.x. I managed to purchase the Head First EJB by Kathy Sierra, Bert Bates and everything seemed to be ok till the moment I started to go thru ejb certification related topics. To be honest I now find it a bit of confusing and am wondering whether the book I bought was the right choice for the SCBCD 5.0 exam (which exam is what I am planning to take)?

Please clarify me what are meant with the terms ejb 2.0, 2.1, ejb 3.0 and SCBCD 5.0