LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Switching Java JDK - impact??? (https://www.linuxquestions.org/questions/programming-9/switching-java-jdk-impact-721957/)

ButterflyMelissa 04-27-2009 05:31 AM

Switching Java JDK - impact???
 
Hi,

I'm using F10 with the Java that came with it. And I'm stuck at something. I am devving an applet, served by a LAN server, the applet does a feedback tru the sys console

Quote:

System.out.println("some stuff");
It seems the IcedTea does'nt even have such a console where I can read the feedback, someone suggested getting rid of the IcedTea and installing the standard Sun JDK - what impact would that have on my machine?

I tried log4j, but it depresses me :-( , and I also tried Java's own logger, it makes a logfile, but the applet (ran from the browser) does'nt write to it - security, of course...

Tnx

Thor
(extra specs of my project available, just ask)

Sergei Steshenko 04-27-2009 05:40 AM

I am not at all a Java guy, by why can't you write your diagnostic output to a file rather than to STDOUT, and then from any terminal do

Code:

less diagnostic_output.log
?

Ot Java applets can't write to files directly, just to STDOUT/STDERR ?

ButterflyMelissa 04-27-2009 05:50 AM

Hmm,

Lemme give that a "whack"...

In fact, I was settled to the idea of having to read a file (using log4j?) or Java's own logger mech, but, as you aplty dotted out: applets cant do that.

Ok, I can see the security holes in windows if and when a System.out CAN actually be read on the console, but Linux just HAS to have some other mechanism...

As said, I'll have a close look at youe suggestions...thanks!

Thor

Sergei Steshenko 04-27-2009 06:38 AM

Quote:

Originally Posted by linusr@flanders (Post 3522252)
Hmm,

Lemme give that a "whack"...

In fact, I was settled to the idea of having to read a file (using log4j?) or Java's own logger mech, but, as you aplty dotted out: applets cant do that.

Ok, I can see the security holes in windows if and when a System.out CAN actually be read on the console, but Linux just HAS to have some other mechanism...

As said, I'll have a close look at youe suggestions...thanks!

Thor

Well, if your applet can write to socket - it's trivial to set up socket listener (server) in Perl, but I do not know how simple is to set up socket writer in Java.

I.e. I mean to send diagnostic output to socket.

ButterflyMelissa 04-27-2009 04:41 PM

Hey, there is a thought! And I mean just that! The very idea, why not write a "thingie" in Perl, listening to the socket the applet sends to/tru/over?

Let me think "out loud" for a moment (it's 23:39 here, I just came out of the shower, just got back from work - so I'm not very lucid anymore :D ...)

I'd write a little "void" (a function that does'nt give a value back) in Java that accepts a string, that void would write to a socket (never even attempted this before) that has a listener - on the same machine - in the shape of a Perl script. So every time I get an error (try/catch construct for example) I'd send the error message to the void-to the socket- to the Perl script- to a console.

Can Perl do that (duh - my Perl knowledge is next-to-non-existend, so sorry about the question)???

Hey, and I REALLY mean that, big thanks!!!

Thor
(having a little more hope again)
:D

Sergei Steshenko 04-27-2009 05:25 PM

Quote:

Originally Posted by linusr@flanders (Post 3522906)
Hey, there is a thought! And I mean just that! The very idea, why not write a "thingie" in Perl, listening to the socket the applet sends to/tru/over?

Let me think "out loud" for a moment (it's 23:39 here, I just came out of the shower, just got back from work - so I'm not very lucid anymore :D ...)

I'd write a little "void" (a function that does'nt give a value back) in Java that accepts a string, that void would write to a socket (never even attempted this before) that has a listener - on the same machine - in the shape of a Perl script. So every time I get an error (try/catch construct for example) I'd send the error message to the void-to the socket- to the Perl script- to a console.

Can Perl do that (duh - my Perl knowledge is next-to-non-existend, so sorry about the question)???

Hey, and I REALLY mean that, big thanks!!!

Thor
(having a little more hope again)
:D

Of course, it can. Here is a short tutorial:

http://www.perlfect.com/articles/sockets.shtml
.

Or/and enter

Perl socket tutorial
Perl socket programming

, etc. into your favorite WEB search engine.

ButterflyMelissa 04-29-2009 04:33 AM

So, this really works...now I have to figure out how to let this work in a browser. I've tried it in the IDE (appletviewer) and there it works perfectly, in a browser, I get an "applet not initialized"...
Security? Dunnow-yet...

The tutorial helped. I'll send all the debug messages tru a socket, and read them in a nearby console...

Again, thanks!

Thor


All times are GMT -5. The time now is 04:32 AM.