Anthony Schmitt

Ranch Hand
+ Follow
since Nov 17, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anthony Schmitt

I'm trying to login to SSH normally, then send six digits to my server, get a response, run expect4j code that matches regex and responds.

My code is almost working, save for that fact that my six digits and following response are being processed by my later expect4j code, and I don't know why.

This is the last line that gets processed before it hands off:
expect.expect("\r\nDestination: ", loginClosure);


I'm trying to login to SSH normally, then send six digits to my server, get a response, run expect4j code that matches regex and responds.

My code is almost working, save for that fact that my six digits and following response are being processed by my later expect4j code, and I don't know why.

This is the last line that gets processed before it hands off:
expect.expect("\r\nDestination: ", loginClosure);


Please, please. please help. I've been stuck on this for at least 30 hours now.
11 years ago
Alright, going on day four trying to get this plugin to work in my application.

Previous thread:
https://coderanch.com/t/572432/GUI/java/Trying-run-class-JFrame

I've tried every single thing I can think of in my extremely limited knowledge of Java to get this to run in a JInternalFrame. I've tried running the applet version and calling the Main.class with no success.

I've been told I can't call an object using jInternalFrame.add(Object). When I try de.mud.jta.Main main = new de.mud.jta.Main();, I get NO SUITABLE METHOD FOUND FOR ADD on compile, and the error points to jDesktopPane1.add(main);

Here's what I know:

Main.class makes a new JFrame. If there's some way I could make it populate MY jInternalFrame in place of making a new one that would be fine. I would also be satisfied with a new JFrame opening in a DesktopFrame in my application. I'd even settle for a completely new frame opening up, (a popup of sorts) at this point. Just ANYTHING to get this SSH terminal to run in my application.

Here's the Main.class source:



How can I get this class to run, and get what it creates to run in a frame in my application?
11 years ago
Main.class creates a frame...



Is there some way to simply tell Main.class to use the JInternalFrame I made in my application instead of making the new Frame?
11 years ago
I managed to run it by pasting the code from main.java (from the source code) into my tester application, so I KNOW I can get this thing to run in my frame! I just don't know HOW...

I noticed main.java creates a JFrame of it's own...maybe I could change that to my frame?

11 years ago

Rob Spoor wrote:

Anthony Schmitt wrote:


You're trying to add a Main object to topPanel. However, you can only add things that are components to containers like topPanel. Since class Main does not extend java.awt.Component or any of its (direct or indirect) sub classes, you can't add it to a container.




Gotcha. Main extends object according to the documentation, so how DO I add it if not through frame.add?
11 years ago
It's a compile error:

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.awt.Panel.add
at applettester.TestFrame.<init>(AppletTester.java:28)
at applettester.TestFrame.main(AppletTester.java:38)


So,

topPanel.add(amain);

and

TestFrame mainFrame = new TestFrame();
11 years ago
I've been trying for the last several days to get either an instance of a class (or an applet which does the same thing) to run in an application I have written. It's a pretty robust piece of software, which may be why I'm not able to implement it successfully. I posted about this yesterday but sadly didn't end up with a working solution.

My IDEAL would be to run this plugin in a frame, I assume. The applet was, I had hoped, the easier of the two solutions but after spending about 20 hours trying to get this to work I may have been mistaken. I'm very new to Java, sort of learning by trial-by-fire, and up until now, it was going OK. I'm probably missing something very simple. I'll try to explain it as best I can:

The plugin is called JTA. It's an SSH terminal that can run as an applet or independantly.

From the website, http://javassh.org/space/Installing+as+a+local+Telnet/SSH+Application:
There are two ways to operate the program. One is to simply start it and to configure everything within the application or to give arguments, like host and port, on the command line. The first way may be the least complicated as the menu entries are self descriptive. End users may find the application mode interesting as it provides a fast and reliable telnet implementation to login to other workstations or text-based online games, such as MUDs.


Regarding MAIN, the class I am attempting to run in my frame:

The Application (Main)
There are two ways to operate the program. One is to simply start it and to configure everything within the application or to give arguments, like host and port, on the command line. The first way may be the least complicated as the menu entries are self descriptive. You need to have installed a java runtime environment or java development kit to run the application. On Microsoft Windows systems an installed Internet Explorer with Java support should suffice though.
Quickstart
Make sure either the program java (JRE, JDK) or jview (Windows IE) is in your path. Optionally you may set the environment variable CLASSPATH to point to the file jta20.jar (see the box to the right for more information). Then try the following command:

JRE or JDK on UNIX or Windows (for Windows and IE installed, use jview instead)
java de.mud.jta.Main
alternative:
java -jar jta20.jar
Now you should see the following output:
** JTA - Telnet/SSH for the JAVA(tm) platformn
** Version 2.0 for Java 1.1.x and Java 2
** Copyright (c) 1996-2000 Matthias L. Jugel, Marcus Meissner
** Build: 20000627-1208
jta: loading plugin 'Status' ...
jta: loading plugin 'Socket' ...
jta: loading plugin 'Telnet' ...
jta: loading plugin 'Terminal' ...

Some other messages might appear, but unless you see an Exception a window should appear on your screen and prompt you for login into your local host. If you are running on windows you will probably see an error message and should append the target host you want to connect to to the command line above.
Command Line Options
The application understand several command line arguments to configure the way it looks and where to initially connect to. The following command line arguments are possible:
de.mud.jta.Main [-plugins pluginlist]
[-addplugin plugin]
[-config file]
[host [port]]
(Options enclosed in brackets are optional and may be left out.)





I have attempted to use this is a JInternalFrame and also in a new test application. For the sake of simplicity I'll post my test application:



and Main:




It seems I can't figure out how to run it correctly. The error I'm getting is NO SUITABLE METHOD FOUND FOR ADD.



Full disclosure, I posted about this in applets yesterday when I was trying the applet approach!
11 years ago
I think this is failing because it's trying to get info from a config file... this is where I get the nullpointer:

11 years ago
You are correct, Paul.

Sadly, I'm still not any closer to getting the applet to run in my JInternalFrame.
11 years ago
So I include BOTH the basic JTA and JTA-SOURCE Jars in my build?

I took out JTA and replaced it with the source jar, now import can't find de.mud.jta.*;
11 years ago
OK, OK! So posting all of this has gotten me thinking. (I'm pretty new to this, can you tell?) I have a JTA jar and a JTA developer's JAR, and looking at Applet.java it's VERY different than Applet.class! Perhaps I need to include the developer jar in my libraries and build and call this instead?

11 years ago
I think I see what I'm doing wrong. Applet.class has methods. Just because I'm making an instance of the class doesn't mean I'm callng the methods.

So, adding init(); and start(); to JInternal Frame, I get a NullPointerException here:

11 years ago
de.mud.jta.Applet is part of the JTA .jar. My understanding of it is that de.mud.jta.Applet does a lot of the stuff you would need to do yourself in your JFrame otherwise.

I'm trying to call Applet.class which will run numerous other classes once it's been correctly called.

The .jar is included in the build, libraries, and all that by the way.
11 years ago