I'm using Spring Tool Suite and learning Spring. I've created a Spring Start Project. The project wizard ask for the version of Boot. I'm just practicing Spring and doing output to the console. Why do I need Spring Boot? There's not way to create a s
I keep getting a FileNotFoundException when trying to initialize my app with Firebase saying it cannot find my adminsdk.json service key. This is a specific error as I am trying to initialize Firebase in an Android Module Servlet. Here is what my mod
I am struggling with Arrays (java) Since this is the first time to learn about java in my life, I have no idea how to start it. I have just learned how to declare arrays and so on. However, this is too complicated for me. I think I can get guidelines
I don't know if I'm doing this correctly, I made a java file var.java public class var { public static boolean u = true ; } in the main activity I have buUn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //var
I need to heavily optimize a piece of java code to the point that I'm wondering if I should use local variables in methods, singletons with private variables or "static classes with all static variables. NOTE: I never read these variables, I initiali
Assuming I had a class Groceries(name,quantity) and the class is used for an array list called shoppingList. ArrayList<Groceries> shoppingList = new ArrayList<>(); The names and quantities of items would be stored in this array list. An item t
When I run this test, why does sleepThread.isInterrupted() always return false? (I had to execute Thread.currentThread().interrupt() to set the interrupted flag when catch a InterruptedException). @Test public void t() { Thread sleepThread = new Thre
I have few buttons and I have the following click listener for the same: private View.OnClickListener onclick = new View.OnClickListener() { @Override public void onClick(View v) { switch(v.getId()){ case R.id.home: break; case R.id.contact: break; c
I'm trying to run my first android studio project but I get this error message and the emulator doesn't start : Created filesystem with 11/4224 inodes and 1302/16896 blocks Failed to create Context 0x3005 emulator: WARNING: Could not initialize Openg
Using Java and no IDE, but rather the command line, I'm supposed to write a basic-ish phone book program focusing around arrays in which the user has three options: search for a name in an array and print the name and phone number if the name is foun
I am working on a class which needs couple of helper methods. This methods are going to be used only by this class. So I am wondering which will be best practice i.e. whether declaring these helper methods as private methods or group them and put ins
I am new to Servlets. I made a simple project with 2 jsp files. and two Servlers jsp1, jsp2, servlet1 and servlet2. When the code in both jsps' body tags is this (Both points to servlet1 ) <form method="post" action="servlet1"> &
I have an unusual requirement to implement. I need to store several objects in a Set. Let's use this simple class as an example - class Name { String first; String last; String middle; } My business rule is that two Name objects are considered equal
I am trying to read a data from a file. I have following code. public void ReadFile() { File sdcard = android.os.Environment.getExternalStorageDirectory(); File directory = new File(sdcard.getAbsolutePath()+ "/MyDirectory"); File file = new File
I am trying to deserialize the 9 objects of the class Planet which are stored on the planetobject.txt file: But it gives me error that says: java.io.InvalidClassException: Planet; local class incompatible: stream classdesc serialVersionUID = -1020679
I've got a problem when trying to execute specific jar files in code. My objective was to create GUI application (wizard) in which user selects various xml files, selects a jar file to execute and provide it with input xml. To execute jar, I use this
iam building a small application to work with variables. The first step is to resolve simple dependencies between variables. I can not get things to run properly. I can resolve very simple declarations like a=10, but it always fails if it gets a litt
public static UserDetail UserDetail.findUserDetail(Long id) { if (id == null) return null; return entityManager().find(UserDetail.class, id); } We are using spring Roo. Above is Roo generated finder method. Partial stack trace is as follows: Caused b
I'm a little confused about the difference between the getFields method and the getDeclaredFields method when using Java reflection. I read that getDeclaredFields gives you access to all the fields of the class and that getFields only returns public
I have a String array like, String[] abc= new String[]{}; and my List has some values. I iterate the list and add each list element to string array. for(int i=0; i<errList.size(); i++) { abc[i] = errList.get(i).getSrceCd(); } errList.size() has 6 val
This is an assignment i have to complete. Can someone lead me in the right direction? The program compiles but wont run correctly. The error is InputMissmatch exception.Your problem is that you are entering a letter into a float field. In your progra
I've found that including a call to System.out.format in the classic Java Deadlock Tutorial will prevent deadlock from occurring, and I can't figure out why. The code below is the same as that of the tutorial, with the addition to main of System.out.
I am trying to compare the contents of a file with a String object. But even though the contents are same, it is telling that the contents are different and adding the same contents again and again. For every run of this code, same content is rewritt
I am writing an Android app and I want to generate random numbers. But, Java's RandomGenerator gives me only pseudo random numbers. The numbers repeat and not all the numbers are covered. I want something that will give me non-repeating numbers and w
I'm trying to improve a Java project which uses a lot of large case statements. In cases where the case statement is used, it is used to handle an event which has an attribute associated to it. For example: public void jumpOverWall(int wallID) { swit
I have an array of ints (e.g. 0, 2, 4, 7). Each value from the array I'd like to combine with another value of the array so that there should be every combination possible(e.g. [0, 2], [0, 4], [0, 7] but also [2, 0], [4, 0] and [7,0] and same for res
I am creating a web page where user can select datasource and execute select statements and see the paginated results in table. Now for pagination i am wrapping queries to get total row count and rownum to fetch a particular block of rows. As we add
I'm using internationalization with Spring, and the properties file needs to be on the classpath. I also have some XML files that will need to be on the classpath. Is it acceptable to just include those resources inside the "src" in a sub-direct
My goal is to create (or use existing) an InputStream implementation (say, MergeInputStream) that will try to read from a multiple InputStreams and return the first result. After that it will release lock and stop reading from all InputStreams until
I need to use an Entity framework with my application, and I have used table - partitions in Oracle database. With simple JDBC, I am able to select data from a specific partition. But I don't know whether I can do the same with hibernate or Eclipse l