0

I need a bit of your help. I hope you could find a minute to take a look at my problem.

I'm using JAVA telnet application ( http://javatelnet.org/space/start )

You can download JTA application at this link ( http://javassh.org/download/jta26.jar ) You can use this applet with html code below:

<html>
<body>
<applet CODEBASE="."
    ARCHIVE="jta26.jar"
    CODE="de.mud.jta.Applet"
    NAME="Appletas"
    style="width: 250px; height: 250px; float: left;">
    <param name="config" value="applet.conf">
</applet>
</body>
</html>

You could also use applet.conf file placed in the same directory as your html page and .jar file is.

For example, if you put these lines inside of the applet.conf file:

Applet.detach           =       true
Applet.detach.startText =       Press to Start!
Applet.detach.stopText  =       Press to Stop!
Applet.detach.immediately =     false

Socket.host             =       10.0.0.1
Socket.port             =       23

Applet would be loaded and you could see .startText (button with the "Press to Start!" text). If you click on that button, application will start. It will try to connect to the device which has ip address of 10.0.0.1 via telnet ( port 23) protocol.

I'm looking how to achieve this with javascript. I want to load this applet hidden at the start. After that, there would be my own buttons, written in html, not in java. I want to call this applet by clicking on these buttons, and they would execute the same java command ( command which is starting the applet when we press a button with .startText).

I know we can call java functions from javascript like this:

<SCRIPT LANGUAGE="JavaScript">
function runAppletFunction()
{
document.AppletName.functionWeWantToCall();
}
</SCRIPT>

So, I tried to find these functions on jta26.jar java code. I found a great java decompiler.

Looks like there is 3 main functions : init() , start(), stop(). Stop function is working, I can call this function from javascript, and java telnet application will close if it's running. I'm not successfull with another functions, there is no errors too. I don't know how could I debug what is happening when I click on the .startText button, and which function is called, because after that click, telnet application is opened (that's what I'm looking for).

To save your time, I will add the main code of the application in another post ( because I can't add more than 2 hyperlinks at once, please reply anyone to this post first), but if you have a minute, please, check my html code with the applet in real. I know you guys could help me to figure out this problem. I just need to call the right function , in the right way.

I highly appreciate your help.

jomajo
  • 37
  • 3
  • 10
  • 2
    can you ask a direct question? – Ibu Aug 10 '12 at 22:45
  • @Ibu It is pretty clear, he has asked us to do his job... – SJuan76 Aug 10 '12 at 22:50
  • Sorry, but I'm asking why for example stop(); function called via JavaScript is working, but start(); or init(); functions isn't. I call all these in the same way, but there is no errors also... Could you give me an idea what I'm doing wrong. There is a Applet.class code http://www.text-upload.com/read,4118048573068 If there is no errors, how I could debug which functions is called when when I click on the "startMessage" button? – jomajo Aug 30 '12 at 21:24

1 Answers1

0

hope this helps http://www.javareference.com/jrexamples/viewexample.jsp?id=81 ?

if it doesnt solve, i think it gives you the reason, that the other two methods might not be public .

Akash Yadav
  • 2,411
  • 20
  • 32
  • Okay , now i feel that your methods are bieng called, but some of the conditions are not bieng met to start or connect, do one thing, Open console and set the log level to All , and see if u could find something there – Akash Yadav Aug 11 '12 at 21:56
  • Thank you for your response. When I try to call these methods via javascript , there is no output in java console at all. If I will call the applet via the applet button , I can see in java console a few new rows: "not allowed to send NAWS? (DONT NAWS)" "network: Connecting http://10.0.0.1:23/ with proxy=DIRECT" It looks like the applet is already loaded, just when I click on the button , the application will open and will try to connect to the device. Also there was no success with html code, I tried to make this "java applet button" transparent, or put an image on it. – jomajo Aug 11 '12 at 23:51
  • So is it possible to debug java / javascript interaction anyhow ? Any other methods anyone can suggest? – jomajo Sep 17 '12 at 22:38