Since the deprecation of the JDBC Bridge in Java, I've been making use of UCanAccess for JDBC connections. However UCanAccess does not throw exceptions in the form of normal try-catches, but immediately prints error lines to the console. As my users will not be accessing the software through the console, I would like to redirect all my console outputs to a JOptionPane message dialog, in order for my users to see error prints instead of it simply going to waste in the non-visible console. Is this possible? I have tried System.setErr, but I can only get to override the write() method, outputting only a int?
Override System.out/err.println
314 Views Asked by anitag95 At
1
There are 1 best solutions below
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in PRINTLN
- The logic is always failing
- Print and println aren't executed in the same time
- Printing off the content of Array or Set using for loop
- Printing lines in reverse java
- Alernative to printf("%*s",indent,message) in java?
- Align predefined text to left and display string aligned to the right. Java
- Formatting Long and Double in Scala println
- Core java printing statement
- Why system.out.println changes reflects without building jar?
- How to copy the terminal output (and input) to a file in java
- adding 1 to an integer within println statement in Java
- I need to make a triforce containing 3 lines of number for each triangle
- Print multiple (not all) elements in an Arraylist on new lines Java
- Java, output continually being output on same line
- Printing the alphabet using for loop. Why must I explicitly convert character [] to string?
Related Questions in SYSTEM.OUT
- Algorithm output to length starts new line
- Why system.out.println changes reflects without building jar?
- Printing to System and to PrintWriter
- Weird behavior in Java While Loop
- How do i print this out?
- How to replace the usage of System.out or System.err by a logger?
- Issue printing array list constructed of defined classes
- arrays print out method java
- How do I display what system.out.println() shows in the console, in an Android Application's activity?
- volatile with System.out.println() in Java
- What is the value of out field in System class?
- how do I use System.out.printf?
- Time complexity of system.out.println
- Manipulate or edit System.out (java)
- Write all System.out into a file
Related Questions in SYSTEM.ERR
- Java 8, El Capitan: System.err.println() output not reaching Console.app
- How to log into a string? Is there a way to capture every console output into a single string?
- Difference in Processing of System.err.print and System.out.print
- Warning/Error meaning - GbaRequest - GbaRequest: Constructor Called 222 userAgent Apache-HttpClient/UNAVAILABLE
- System.err.println and System.out.println not getting in log file
- Where do messages sent to System.err go when using Tomcat externally to run a web app from IntelliJ?
- Synchronize System.out & System.err
- Race between System.out and System.err in java
- Weird behavior when using System.err.println()
- difference between System.out.println() and System.err.println()
- Are Java System.in/out/err always open?
- Does jsch session own error stream, when it is set, and no other thread can use it?
- System.out.err & System.out interleaving in Java
- Redirect the output of System.err.println to a file without code change
- Override System.out/err.println
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
UCanAccess throws exceptions in "the normal form", so your question is a bit misleading and your assumptions are wrong.
Also it uses SQLWarning while loading the db, see the jdbc interface about it (e.g. if it can't load a query). The UCanAccess console just prints them.
At Last, in the case of database corruption, data integrity problems or other very high severity problems jackcess or ucanaccess may print on the System.err. Obviously it may happen just if they are not blocking despite the severity. It's just to be sure that error message is logged without blocking a succesful db loading with an Exception(so I can't use a SQLWarning for them ).
For those specific issues you can redirect the System.err messages to a JOptionPane, but they are often very technical errors about mdb/accdb format, so I think it isn't a good idea show them in a user interface.
To re-direct the system.err in a specific error file instead(for subsequent problem solving) is much better.