Keith Owen

Greenhorn
+ Follow
since May 21, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Keith Owen

It is most likely a problem with your HTML. Swing can be tricky when it comes to that. Would you care to post your HTML document, or at least the part that references your applet?
-Keith
23 years ago
Actually, the linux users are probably a bit less poor than the windows users considering they at least received their OS for free Also in their favor is a much easier road to clearing a vt100 terminal. Outputing the ANSI character sequence for clearing the terminal will do the job just fine.
As an alternative, you *could* use the JNI method in linux/unix as well, with no code changes, by recompiling the NativeMethod.c into a shared object library (*.so) using gcc instead of making the win32 DLL. I believe a recompile of the java classes is necessary, also.
And to the Mac users ... well, they will just have to stay poor until a Mac-acquainted Java programmer strolls along
-Keith
23 years ago
I hope so
-Keith
23 years ago
It sounds like the file you are downloading just keeps getting corrupted. I'm not sure what could be causing the problem unless the source where you are downloading the file from is actually corrupted, as well, but if you are using HTTP to download the file, you may want to try using FTP as an alternative or vice versa.
-Keith
23 years ago
Here are full instructions on how I accomplished using the clrscr() C function in Java using JNI. I used the Borland C++ 5.02 compiler to make the DLL because VC++ does not provide a native clrscr() function in any of its include headers, so steps on building the DLL are BC++-specific. However, the compiled DLL, which you can download here can be used as-is w/out recompiling.
[list]create NativeMethod.java with the following code:

Where "NativeMethod" is the name of the DLL compiled in later steps.[list]run javah on NativeMethod.java to create NativeMethod.h which should look like the following:
  • add #define __int64 long to NativeMethod.h above the #include <jni.h>
  • [list]create NativeMethod.c to look like so:
  • compile the native dll with this command:

  • bcc32 -tWDE -eNativeMethod.dll -Ic:\jdk1.3.1\include -Ic:\jdk1.3.1\include\win32 NativeMethod.c
    note that your JDK path may be different than mine.[list] write a driver program to test your new native call. mine is named Example.java and looks like this:
  • compile the java: c:\>javac NativeMethod.java Example.java
  • run the app: c:\>java Example

  • If you want to skip the steps used to create the DLL, download the DLL I have created @ the URL above, create the two java files I listed and then go through the last two steps.
    -Keith
    [ May 29, 2002: Message edited by: Keith Owen ]
    [ May 29, 2002: Message edited by: Keith Owen ]
    23 years ago
    I managed to get this working using JNI. I'll post some instructions and a link to the necessary dll later today.
    -Keith
    23 years ago
    Dirk -
    Any luck in figuring out what the problem is? I have still been unable to get it to *not* work =/
    -Keith
    23 years ago
    the new design is great! much better than the predecessor.
    -Keith
    23 years ago

    So maybe the Saloon is a testament to Perl's capabilities!


    that it is ... and a darn good one, too!
    -Keith
    23 years ago
    The replies I had already received were completely acceptable. I was only curious as to why this site chose not to go with a pure java solution and I received my answer.
    While I agree with you that being stuck on one particular technology is certainly a bad thing, if Sun (or anyone else for that matter) chooses to display proprietary information using non-proprietary, competitive tools, they are promoting the use of said tools and demoting the use of their own. I am certainly not frowning upon JavaRanch for their choice of BBS software, but I do think it would be a testiment to Java's capabilities if the entire site were Java-driven.
    -Keith
    23 years ago
    That is odd, Dirk. I'm curious; are you using XP Home or Pro, and which JDK are you running that bit of code with?
    I am using XP Pro w/JDK 1.3.1_01 and the function above works as it should. I also tested this @ work on a Win2k SP2 box w/same JDK and observed the same result.
    -Keith
    23 years ago
    Indeed it seems that a quality, free, and opensource JSP/Servlets forum package would be of great interest to at least some.
    Thanks to all for your suggestions on where to get ideas. Anyone who wishes to be part of the project, please feel free to send me a private message.
    -Keith
    23 years ago
    I've come across a solution that works suitably for me on Win2k and WinXP:

    The only downside to this approach is that calling mode.com resizes the console window to whatever values are specified. The values I have used above are the default width and height of a DOS window in Win2k/XP. If mode.com is called with values for cols and lines that are different than the DOS window your java app is running in, the window's size is adjusted to meet the new values.
    -Keith
    [ May 22, 2002: Message edited by: Keith Owen ]
    [ May 22, 2002: Message edited by: Keith Owen ]
    23 years ago
    that is nice, but not free or opensource. i think i will actually attempt this. it can't be *too* hard with some help.
    ... just as soon as I finish raising clrscr() from the dead with some JNI per a post in the Java Beginner Forum.
    -Keith
    23 years ago
    Thanks for the welcome, Dirk.
    I had already searched the forums and come across the threads you've mentioned, none of which lead to the resolution of my question.
    There appears to be three main approaches to accomplishing the task of clearing the screen:
    1) Output enough newlines that the screen is effectively cleared. This approach has one major problem - the number of rows in the console is not constant, ie, i can change the size of my dos window.
    2) Output an ANSI sequence forcing a clear screen. This will not work in Windows 2000 as an ANSI driver is not used in the console.
    3) Make a call to Runtime.getRuntime().exec(), passing the system-specific command to clear the screen. This does not work either. Though I am not absolutely sure why, it seems like this would create a new console window and then clear it.
    So, my queston is still unanswered. Any suggestions anyone may have would be greatly appreciated. And I must add, I *love* your forum There is LOTS of great information here.
    -Keith
    [ May 21, 2002: Message edited by: Keith Owen ]
    23 years ago