logo
down
shadow

Java console Input/Output/Error redirection to another (Delphi) application


Java console Input/Output/Error redirection to another (Delphi) application

By : Ahmed Mohsen
Date : November 17 2020, 04:28 AM
I wish did fix the issue. I have found a solution to my problem. You need two command prompt processes, each constructed with a Read, Write and Error pipe in Delphi.
One of them runs the Java application and is set to wait for a debugger to be attached before executing and the other is for debugging and is attached to the waiting Java application.
code :
java -agentlib:jdwp=transport=dt_shmem,address=DelphiExecutingAppAddress,server=y,suspend=y MyClassFile.java
jdb -attach DelphiExecutingAppAddress


Share : facebook icon twitter icon
Keeping input/output separated in Java console application

Keeping input/output separated in Java console application


By : Vijay Madhavan
Date : March 29 2020, 07:55 AM
like below fixes the issue I recall a long time ago working with similar things but in C++. I was using the ncurses library then. Check out javacurses which seems to be a Java implementation of something like ncurses.
Ant Java task : how to get output to console and a file-always record build output without shell redirection

Ant Java task : how to get output to console and a file-always record build output without shell redirection


By : Siddhanth Shetty
Date : March 29 2020, 07:55 AM
Hope that helps Ant has a way to record output. http://ant.apache.org/manual/Tasks/recorder.html.
code :
    <compile >
        <record name="log.txt" action="start"/>
        <javac ...
        <record name="log.txt" action="stop"/>
    <compile/>
C input and output redirection error?

C input and output redirection error?


By : Chris Anders
Date : March 29 2020, 07:55 AM
With these it helps Assuming that filename is the name of the executable generated on compiling your C code, maybe you should try using
./filename < filename.txt > filenameoutput.
Delphi Console Application increase input character limit

Delphi Console Application increase input character limit


By : Mr.Kuts
Date : March 29 2020, 07:55 AM
may help you . AFAIK, you can't make the RTL's Readln() function accept more characters (though internally, it is coded to run a loop that should be able to handle more than 254 characters). It seems by default, when you paste your 300-char test string into the console window, it stops taking characters at 254 even before you press Enter.
But, you can use a different approach - call GetStdHandle(STD_INPUT_HANDLE) and then call ReadFile() on that HANDLE to read however much you want. If you use a buffer that is at least 300 bytes, it will happily accept your 300-char test string:
code :
program Project3;

{$APPTYPE CONSOLE} 

{$R *.res}

uses
  System.SysUtils, Winapi.Windows;

var
  buf : array[0..299] of AnsiChar;
  MyTest: AnsiString;//string;
  hStdIn: THandle;
  dwNumRead: DWORD;
begin
  try
    //Readln(MyTest);
    hStdIn := GetStdHandle(STD_INPUT_HANDLE);
    ReadFile(hStdIn, buf, sizeof(buf), dwNumRead, nil);
    SetString(MyTest, buf, dwNumRead);
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
program Project3;

{$APPTYPE CONSOLE} 

{$R *.res}

uses
  System.SysUtils, Winapi.Windows, System.Classes;

var
  MyTest : String;
  strm: THandleStream;
  reader: TStreamReader;
begin
  try
    //Readln(MyTest);
    strm := THandleStream.Create(GetStdHandle(STD_INPUT_HANDLE));
    try
      reader := TStreamReader.Create(strm);
      try
        MyTest := reader.ReadLine;
      finally
        reader.Free;
      end;
    finally
      strm.Free;
    end;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.
Delphi: how to capture COLORED output of the CONSOLE application?

Delphi: how to capture COLORED output of the CONSOLE application?


By : Tommy Hu
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You wil have to hook all of the console output functions (say, WriteConsoleOutput; see MSDN Library for the list of them) to access the process' screen buffer, then pass the intercepted output to your application via shared memory or a pipe. AFAIK, there's no other way to get access to console output handles of another application.
Related Posts Related Posts :
  • Forcefully terminating a thread I didn't write in Java
  • Issue with ojdbc jar in Maven
  • String array length java
  • Java basic compilation error
  • Inquiry about writing a Char via ByteBuffer
  • Getting unexpected results when type casting between long and double
  • Variable throws variable might not have been initialized error
  • Start/stop java application from an external script
  • Confusion in declaring String Objects
  • What are some ways to do multi-core programming on Android, not just multi-thread?
  • hibernate - process scoped identity
  • Null Pointer Exception on getGraphics()
  • Can we print a java message on console without using main method, static variable and static method?
  • sending text from editText to ListView (2 activities)
  • Transfer value from JList to another class in Java
  • Creating 2 streams with one socket
  • How measure time stolen from virtual machine, in Scala/Java?
  • How can I programmatically generate keypress events?
  • org.apache.commons.net.ssh documentation
  • Implementation of Dijkstra`s Algorithm - Stuck in an infinite loop
  • Should I throw IllegalArgmentException when 'user of given id not exist'?
  • In Nimbus, how to paint TextField when MouseOver?
  • why won't checkforWin(File f) return true when it is true?
  • Android: Cursor is always returning null even if the database is not empty
  • Repeating for loop in menu
  • Can Java garbage collector randomly delete objects in the On-Heap tier?
  • Apache CXF Exception: SSL connection unexpectedly closed
  • Add properties to ArrayList<Object> in Java
  • Multiple Adapters or One Adapter for different lists and objects - Code Performance
  • Is it good practice in Java for a class's method to redundantly return a modified global field of the class?
  • How to change the color of the background in libgdx labels?
  • direct file path not working
  • ClassFileTransformer + Javassist: no such field
  • How do I change and instance variable for an object which the user selects from a combobox?
  • reading and updating a large xml file in java
  • ActionListener and Thread.sleep
  • What is the maximum of number of arguments for varargs in java?
  • When I compile I get an error as "ask" cannot be resolved or is not a field"
  • What is the best way to check if 4 integer variables are equal to 0?
  • Storing constant webdriver elements in an enum
  • Java: Why main class does not extend Thread class
  • Java - how to find out if a directory is being used by another process?
  • How can I get a method to print?
  • Java unknown exceptions
  • BufferedReader,StreamWriter crash
  • found raw type: JComboBox
  • Java Generics -> Function return type
  • how to refresh contents of jtable on event of action listener?
  • Why does List interface extend Collection interface?
  • Pros and Cons of Clojure http client libraries
  • use final inside a for each loop
  • Convert java data object to service object
  • Unsupported major.minor version 51.0 while executing JSP
  • How do I display a word diagonally in Java?
  • making sure one task completes before another starts in java
  • My program gives an index out of bounds error
  • Removing duplicate characters in a String (user inputted keyword)
  • Jersey 2.0 Content-Length not set
  • AWS.SimpleQueueService.NonExistentQueue Exception thrown when Accessing Existing SQS queue
  • Where can I find the source code for the com.sun.jdi package?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org