|
Thank you so much for helping me sir but l didn't got your point that what you're trying to say.
|
|
|
|
|
Open a cmd window and type "javac -version". The result will tell you which version of the JDK you have installed.
|
|
|
|
|
|
Might want to also use the following commands. Just as with the other in a command window.
javac -version
where java
where javac
First will show the compiler version. Which should be the same as the java version.
Other two will show you where it is finding those commands so you can verify that it is what you expected.
|
|
|
|
|
Good afternoon! I'm trying to create a custom generic Bean Validator for the email of an author and the name of a category to verify that they are unique and I wish I could use a custom JPQL, the name of the persistence unit in persistence.xml and other variables. However, I don't know how to pass variables inside isValid, I only know how to hardcode them.
public class UniqueFieldValidator<T> implements ConstraintValidator<UniqueField,T> {
@Override
public boolean isValid(T value, ConstraintValidatorContext context)
{
EntityManagerFactory emf = Persistence.createEntityManagerFactory("project");
EntityManager em = emf.createEntityManager();
String jpql = "select a from Author a where a.email = :pEmail";
TypedQuery<Author> query = em.createQuery(jpql, Author.class);
query.setParameter("pEmail", value);
Optional<Author> optAuthor = Optional.of(query.getSingleResult());
if(optAuthor.isPresent())
{
return false;
}
return true;
}
}
modified 3-Jul-21 13:26pm.
|
|
|
|
|
Default Is Valid Implementation As Below public boolean isValid(Object value, ConstraintValidatorContext ctx)
|
|
|
|
|
Hi I am developing a library management system in net-beans. When I run it on my system it works fine however, if try to run it on another system it gives me an error of javax.persistence.Persistence.createEntityManagerFactory("path_to_database_on_my_system"). But this path to database must be changed in this function. How would I do this? Need Help.
|
|
|
|
|
Been messing around for hours and eventually decided to seek the assistance of the internet.
I am trying to make a program where I/the user can add elements into an array (Name, age gender). Once elements have been added to the array, I want to then be able to search a String (name) to find the desired name I am after in the array. The context of the program is adding Climbers to a Climber Database (just an array) of who has climbed what mountain (haven't attempted adding the mountain stuff yet).
In what I've written so far, I keep getting the return null, saying that the searched String cannot be found. I have a feeling that I am failing to pass the parameters of the added element in the array.
For example, I add a 'climber' with the name John, 19, Male in the Climber Class. I then go to the ClubStats class to getClimber and search "John", the only one in the array and I receive a null..
FYI I am using BlueJ here so at a serious basic level.
public class Climber
{
private String name;
private int age;
private String gender;
public Climber(String newName, int newAge, String newGender)
{
name = newName;
age = newAge;
gender = newGender;
}
|
|
|
|
|
I understand that a NPE can come from a variable or method returning null. But what I'm trying to do is get a bank account balance. To do this I first have to correctly enter the account id and nip, which I can do without problems. Then I have 4 options to pick from (right now I only have one implemented properly) so I pick Consulta (consult) and what I should be getting is the account balance but I get a NPE error. Can someone help me figure this out? The classes involve during this process should be SolicitudSaldo (consult balance), ATM, Cuenta (Account), BaseDatosBanco (Bank data base) and Transaccion (Transaction). I think the problem might have to do with how I declare ATM in my Jframe INTERFAZ_TRANSACCIONES.
I'll paste a link to my code since It's quite a lot and I don't want to make this post any longer. My project is in the master branch.
Heres a link to my project in gitHub
GitHub - Emmanck613/ATM_02[^]
|
|
|
|
|
No, we can't - as you say it's "quite a lot" of code - and it needs your data to duplicate the problem.
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. How you use it depends on your compiler system, but a quick Google for the name of your IDE and "debugger" should give you the info you need.
Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.
Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Fortunately I seem to have found the problem, as I suspected, it had to do with how I declared ATM in my jframe.
|
|
|
|
|
<pre>It becomes a name store of 10 names. A random name is chosen from among these 10 names. A line is added with a space between them as much as the number of letters of this name. Try to find this name in 5 guesses. When a correct letter is known, if this letter is more than 1 in the word, they should all be revealed together.</pre>
|
|
|
|
|
This has nothing to do with eclipse, and not a lot with Java. You need to write a specification of the problem showing all the steps needed to get the answer. Once you have that then you can think about writing the Java code to implement it.
|
|
|
|
|
Hey everyone! Last fall, a friend of mine gave me an app idea. It was a multiplayer game that she was handmaking for a while and she wanted me to make a digital version of it.
The rules of the game are similar to Cards Against Humanity - each round, a question is displayed and every player has to answer it with one of the cards in his deck. A delegated player picks the funniest match and the winner gets a point.
I spent a lot of time and effort making this. Any review or feedback would be appreciated!
|
|
|
|
|
We can't review or give feedback - we don't have the app to look at - and if you start posting EXE files no one will download them, if you post a site link we'll assume it's spam, and a store link we know it's spam.
So all we can go on is the description: which is so close to the original that it's probably actionable:
We own the name “Cards Against Humanity,” the graphic design of our game, the slogan, logos, and all of our writing. That means you need a license from us to use any of those things. Please don't make something that's an obvious knockoff of Cards Against Humanity's brand or name. In the United States you have to defend your intellectual property or you lose control of it; please don't force us into a legal conflict where we have to defend ourselves—we just want to write jokes.
I'm not a solicitor, nor do I live in 'murica - but in the UK we have the A moron in a hurry test[^] we this would probably fail.
So ... best I can do: not a review, not really feedback - but I'd think long and hard before I took any further steps with this app if I was you ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
If it was that great, you wouldn't need comments based just on an idea. And another player gets to pick the winner ... Right.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
|
This program is supposed to calculate the area of an equilateral triangle, a square, and a hexagon, given a line length (s) 5 times each and pass them into their own respective arrays. It then calculates the average area of each, the area closest to the average, and the area furthest from the average in each array. Every time I run the code it returns an area of 0.0 for the closestTriangle, closestSquare, and closestHexagon. I cannot figure out why it won't calculate the areas correctly. Can someone please steer me in the right direction so I can figure out where I went wrong?
modified 18-May-21 9:51am.
|
|
|
|
|
Didn't you try to debug your code? 
|
|
|
|
|
Seriously? Without seeing the code, how do you expect anyone to tell you what you did wrong?
|
|
|
|
|
Dave Kreskowiak wrote: Without seeing the code, how do you expect anyone to tell you what you did wrong? Rookie. 
|
|
|
|
|
|
Yes, we can steer you in the right direction.
Step 1, post your code.
|
|
|
|
|
I am new to maven and javaFX. I am having trouble loading my fxml files into the FXMLoader. And also I don't really understand the project structures with Maven and without Maven.
I found this article on stackoverflow which seems quite comprehensive, however I could not understand the explanation why, in a Maven project, I need to duplicate the folder structure in "resources".
I tried to post an imagefor better explanation but was unable to find the option in this forum.
image: chrome 5QsdzWr8VA - Gifyu[^]
modified 3-May-21 14:59pm.
|
|
|
|