For some reason, all of a sudden my app cannot build anymore. First I had flutter devtools problem, then I upgraded to Flutter 2.8.1 and now my app cannot build. I tried upgrading Gradle to 7.3.3 and JDK 17 and still, my app cannot build, I searched the whole GitHub and StackOverflow and cannot find a solutio…
Tag: java
Save to a variable the number of times the user answered “no” in java
good afternoon, I’m studying java, happened to get an assignment to make the following questions: give input to the scanner “do you want to close this application? ” If the answer is “no”, the input will appear again with the same question. If the answer is “yes” the …
MongoDB how to test locally in Java a MongoDB database, like H2 with sql database?
I’m developing a program that use MongoDB database but I’m asking if it is possible to use an internal database for test like H2 when doing SQL through Java? Answer You can try to use Testcontainers Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instan…
Define Spring dependency matching a Spring Boot version
I am developing two projects. Project 1 is a spring-boot application based on gradle for dependency management. This application defines extension-points. If – at runtime – an extension is found on the classpath, this extension is being called from the main application under certain circumstances.…
java – creating 2D array (matrix) from two 1D arrays
Given How do I programmatically achieve: with Yes everything needs to be Object, Object[] or Object[][] due to upstream constraints ie. TestNG @DataProvider. Answer A couple of nested loops does the magic but the dimensions of the retVal are different: Test: Output (not pretty-printed): [[J, diamonds], [Q, di…
Compiling a java project from linux command line
I am having trouble understanding how to actually use the command line to run a big java project ( by big I mean with multiple files and folder). Imagine I have a project containing : All my life people have done the makefile for me. I just code the java src with vim and compile and run with make. Now
Token exchange in Spring OAuth2 client credentials flow
I have following Spring Security configuration: And following configuration is used: Now I need to do impersonation(https://datatracker.ietf.org/doc/html/rfc8693). So I need to pretend as some user. I need it because of “current user” logic inside some-app application. How can I reconfigure to ach…
ClassOrInterfaceDeclaration.getTokenRange() gets all the tokens for a file even after removing nodes from the class
When I remove “ClassOrInterfaceDeclaration” nodes from a class in CompilationUnit (JavaParser) from a parsed file that contains more than one class, ClassOrInterfaceDeclaration.getTokenRange() gets all the tokens even the removed nodes tokens. For example, the code snippet at positions 1 and 2 wil…
Cannot use base class without passing its type in Java
I want to create a common service and common request as shown below: Then implement this service as shown below: However, although CompanyARequest is inherited from CommonRequest, createOrUpdate method throws “Method does not override method from its superclass” error. On the other hand, if I use …
event when press exit button: JOptionPane.showInputDialog
How can I add a function after clicking on the cancel or exit button? I tried it like this but it doesn’t work for me. It shows me an error that choice is null but it couldn’t be because it is int? is there any other possibility to solve it? Answer When you press the “exit” or “c…