Win a copy of Java Challengers this week in the Java in General forum!

Beata Szabo-Takacs

Ranch Hand
+ Follow
since Jan 26, 2020
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 Beata Szabo-Takacs

Dear Matthew,
Thank you for your response. I could solve the issue based on
the second answer in https://stackoverflow.com/questions/768966/running-2-threads-simultaneously.

I changed my code from FileWriter to void and I set up a Swing Frame in one runnable thread
and I used another thread for file writing and run them simultaneously e.g.


3 months ago
Thank you Tim for your help! I tried your suggestion but unfortunately,
SQL connection blocks the JProgressBar or any GUI. According to
my best knowledge, swingworker should fix it. I do not have experience
in swingworker. Could someone help me how I should use it in the above-
mentioned code?
3 months ago
I would like to use JProgressBar to show the progress of
Java MySql connection. Is there any MySQL query which can use as
JProgressBar ?
I would like to show a running process stage with a pop-up frame. The created a javax.swing.JFrame is:



The input String text is produced in a for loop like:



When I use  this.setLocationByPlatform(true) in the Frame it will produce the correct Frame but I will get the error after the first step of the loop:
java.awt.IllegalComponentStateException: The window is showing on screen.
at java.awt.Window.setLocationByPlatform(Window.java:3450)

If I skip the setLocationByPlatform it will produce an empty Frame. Could someone suggest me a way for getting one Frame where the string will change according to the loop?


3 months ago
I have a java program which can download data from MySQL and write them in a chosen file format e.g. TXT. Here is the txt writer:



This writer is called in a JCombobox actionperformed as in an other java file:



I would like to show the progress of the writer with JprogrssBar, but I do not know how should
I measure the writer progress (i.e. the integer value for set the JprogressBar value). Could someone suggest me a solution?

3 months ago
Finally, I could solve the matter. I checked the code
on Linux OS where the java path was jdk\jre. I changed the path of
the java to jdk\bin by editing the .bash_profile. The code works now.
4 months ago
I used cmd and I applied the command line as you posted. It works correctly. But I do not understand why does not work correctly if I just click to the .jar file?
4 months ago
Dear Norm,
Thank you so much for your suggestion. It works correctly. What do you think I should set the path of the environment variables as C:\Program Files\Java\jdk1.8_151\bin\java.exe?
4 months ago
Dear Tim,
I have tried it but I got the error that the is missing. I have the same problem as in: https://stackoverflow.com/questions/49711640/javacompiler-always-null-with-jdk-versions-1-8-0
I need the InMemoryJavaCompiler because I wrote a java Class with StringBuilder and I have to compile it. Here are the details of my purpose: https://coderanch.com/t/725893/java/convert-strings-executable-Java-code#3378151
I do not understand why does not work the .jar file which was developed and built in NetBeans 8.1 IDE? If I understand well NetBeans has compact profiles which contain the required but I do not understand why the "is missing" or the created .jar file does not find after the packing and building.
4 months ago
I use NetBeans 8.1 for developing a Java project. I use InMemoryJavaCompiler in two classes. When I run the project under NetBeans it works correctly. I created a .jar file from the project with When I try to run the .jar file the program does not work. It generates a NullPointerException regarding InMemoryJavaCompiler:

According to https://stackoverflow.com/questions/2543439/null-pointer-exception-while-using-java-compiler-api most probably the ToolProvider.getSystemJavaCompiler() returns null. I checked the java.home in NetBeans with which is:

I tried to add and move up the from in NetBeans and built again the program but it doses not help. On my computer, the java path is.
Could someone suggest me a solution to fix the nullpointerexception error?
4 months ago
Here is the ComPiler.java class where I used InMemoryJavaCompiler:



and here is the part of the code where I called the ComPiler Class:

I receive the following error:
java.lang.NullPointerException
       at org.mdkt.compiler.InMemoryJavaCompiler.compile(InMemoryJavaCompiler.java:19)
       at meteoread.ComPiler.CodeFromString(ComPiler.java:261)
....

The JDK 1.8 is installed on my PC.
4 months ago
I wrote a Java project in NetBeans IDE. This project contains two abstract Java Classes which are compiled with InMemoryJavaCompiler.
When I run the code in the IDE it works. I produced a .jar file from this project with build packing and clear and build.
When I run the .jar file I receive a NullPointerException error when I use the abstract classes.
Could someone suggest some solution?
Thank you for your help in advance!
4 months ago
Dear All,
I would like to use an AWT label to show the error messages in a JFrame.
I tried to set the label size according to the text size. Here is my code:



When I get a long error message e.g.:
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Communications link failure

only one part of this text will be shown. Could someone suggest me a solution to fix this issue?
Thank you for your help in advance!
9 months ago
Thank you very much Tim for your suggestion! I accepted. I could solve the issue with the following code:


9 months ago