Most voted "java" questions
Use this tag when the question refers to some resource, information, or problem relating exclusively to the Java programming language. Java is a class-based, statically typed, reflective, and execution environment (JRE) language. Java programs are compiled to bytecode and run on a virtual machine (JVM), allowing a "write Once, run Anywhere" philosophy (WORA).
Learn more…14,468 questions
Sort by count of
-
3
votes4
answers3475
viewsHow to return 2 variables of a function
I am accessing a webservice, that has as return: listProdutos[] -> List of all products or null when there are no products When you lose access for some reason, you make an exception, in which…
-
3
votes1
answer2284
viewsUsing Imagemview to upload gallery photo
I want to make a program that I upload a photo to a ImagemView from the Android gallery. I need a code to open the gallery and save the image as if it were a profile.
-
3
votes2
answers551
viewsData source failed with JPA and Eclipselink
When I put for the persistence.xml use a JNDI Resource configured in Glassfish itself. But when it is to take from the file glassfish-resource.xml gives the following error: Information: [EL Info]:…
-
3
votes3
answers3004
viewsAccess data from already instantiated classes
I need to access data contained in class variables already instantiated from other classes User_Info info = new User_Info() I think I would need the memory address that is the right "info"? public…
-
3
votes2
answers4918
viewsHow to count how many times an item repeats in an Array with unknown size?
How to count how many times an item appears in an Array I don’t know the size of? The array was created from a . CSV.
-
3
votes1
answer1056
viewsHow to include . jsp file in solution?
I am developing Java web applications using JSP’s. I have a file called header.jsp, which contain links from CSS files and other things that are important to my system that is in the root directory.…
-
3
votes1
answer244
viewsMatrix in Forms
I’m having trouble creating a matrix within a JPanel in Netbeans, I tried to customize the code by placing within the Netbeans customization code: jPanel1.setLayout(new GridLayout(15,15));…
-
3
votes3
answers43625
viewsRegular expression that accepts only numbers and/or letters in Java
How to develop a regular expression that allows a string to have only numbers and/or letters in any position and quantities? Examples: to) 00000a b) 000000000A c) AAAAAAAAA0 d) 1AAAAA1113 and)…
-
3
votes1
answer1325
viewsCapturing user name logged into machine
I need to add in my program a method where it will capture the logged user from the machine and then display it to the client. The client will run the program, and then it will show you information…
-
3
votes1
answer613
viewsHow to know which page is responding to the JSP request
I have several pages JSP , and treat them all in mine servlet Control. I wonder if you have how to identify which page is being displayed so I can do all treatments , requests and responses,…
-
3
votes1
answer2884
viewsHow to disable automatic Java update?
How to disable the 64-bit Java 7 update? I entered the Java control panel and the update tab does not appear. Note: I cannot update my version.
-
3
votes3
answers1649
viewsSend email with STARTTLS porta 587
I need to send an email using client settings. Host access uses STARTTLS security using port 587. For testing I set up the following code (I changed the customer data for security): try { String…
-
3
votes1
answer1628
viewsSpinner with states and cities?
How does a spinner with states and cities of Brazil? By clicking on the state, list the cities? What is the way to do this? An all-registered bank? Sqlite? Need a model ready for states and cities?…
-
3
votes1
answer293
viewsLog into android application when errors occur
Hello, I wonder if there is any way to send the application log, or perform some action when an error occurs in an android application (when the message is exeibida: "The application stopped…
-
3
votes1
answer94
viewsHow to exit the controller before reaching the end with Vraptor 3?
Do you have a command in vraptor 3 that will allow you to log out of the controller before you get to the end of it? 'Cause I have a controller that if a particular one happens process in the middle…
-
3
votes1
answer1635
viewsJDBC Sqlite - Java
Good afternoon, How do I make the connection to the Sqlite BD? I made the connection class like this. package model; import java.sql.Connection; import java.sql.DriverManager; import…
-
3
votes1
answer1582
viewsip camera streaming
I need to make an app to connect to an ip camera the camera I have is the dcs-932l - d-link I need some hint, research or example. tried with Videouri believe that not…
-
3
votes1
answer465
viewsHow to use java.String.format in Scala?
I’m trying to use the method .format string. But if I put %1, %2, etc. in the string, the java.util exception.Unknownformatconversionexception is released, pointing to a confusing Java code: private…
-
3
votes1
answer1013
viewsI cannot generate the table by Hibernate
I’m trying to create tables automatically by Hibernate, but I’m not succeeding. The Iberian libraries are correct. mysql connector is referenced as well as Hibernate libraries. I believe the problem…
-
3
votes1
answer767
viewsCreate and manipulate multidimensional associative array
How can I create a multidimensional associative array in Java? Something like this: Array = { "carro 1" : Array { "portas" : 5, "cor" : "preto", "km" : 10670 }, "carro 2" : Array { "portas" : 3,…
-
3
votes1
answer113
viewsJdialog does not show Jlabel
I created a class called Jdialogprogress, but when I "call it" the Jlabel object does not show on the screen. I’m calling it that: JDialogProgress Progress = new JDialogProgress(new JFrame(),…
-
3
votes1
answer1195
viewsError when another class calls an Activity method
In the monitoring it sends an SMS to a device that responds with another SMS and update the screen and at the moment it calls the method to update the screen of the error. Error log: 01-14…
-
3
votes1
answer219
viewsOracle 12C + Java + Xmltype
Hello, Good morning in my company we are testing the Oracle 12c. And I found a "little problem" to query a field that is the type Xmltype. We store all the nfe xml in the database, so we always have…
-
3
votes3
answers391
viewsDoubt in Arrays - Beginner
How do I make the method mostraEmpregados print on screen the name of the employees I’ve already added? How to build the array within the Enterprise class statement itself, making it every time a…
-
3
votes2
answers136
viewsProblems in the implementation of methods
I have the following classes: Door package meu.programa; public class Porta { boolean aberta; String cor; double dimensaoX; double dimensaoY; double dimensaoZ; void abre() { if (aberta == false) {…
-
3
votes1
answer1204
viewsHibernate with multiple databases in the same application
A system uses for each client a separate database, let’s say I will have 500 clients, in which case my database server would have 500 data bases, example: cliente1 cliente2 cliente3 In the Hibernate…
-
3
votes2
answers202
viewsView . HTML with Vraptor. Is it possible?
I am a student of Analysis and development of systems and I love programming, I studied the basics of Java and I am searching frameworks just to get a sense. How do I return an HTML page in a…
-
3
votes1
answer754
viewsDifference between Httpclientbuilder.create(). build(), Httpclients.createDefault() and Defaulthttpclient
When creating an HTTP connection using: HttpClientBuilder.create().build(), HttpClients.createDefault() or: DefaultHttpClient. What’s the difference? private static CloseableHttpClient httpClient =…
-
3
votes2
answers2737
viewsHow to create two different database connections?
I need to pass data from one database (DB2) to the other (Mysql), and I’m thinking about how to do this, as in the database I have the data I do not have access to some tools, how to do the backup,…
-
3
votes3
answers2210
viewsRemove First Word from String
I have a stringBuffer with a sentence inside. I need to remove the first word from the string. Making the second word become first and the number of words x-1.
-
3
votes1
answer727
viewsCreate data validation and page sequencing
I’m starting in Java and I want to make a screen where the person register the login and password, the system stores the data and then, in a new window is asked to enter the user and password, I did…
-
3
votes2
answers89
viewsDesktop widgets in Java
I’m with an idea to create a widgets with support functionality for my company. I wonder if you saw java I could create something, if there is any framework or some Java technology where you can…
-
3
votes1
answer373
viewsHow to change the language of the exceptions released during automated testing
Using Eclipse (IBM RAD Studio), Maven, and Junit, when an exception is released while running the tests the message is shown in English. I would like it to be shown in English. Example:…
-
3
votes1
answer805
viewsDoubt with the function compareTo
When I run the code below the compareTo returns a value less than zero. public class compare { public static void main ( String [] args ) { String str1 = "araraaaaaa"; String str2 = "asa"; int comp…
-
3
votes1
answer5335
viewsJava remove an item within a chained list Simple
I am having difficulties in generating a code to remove an item from a certain position in a chained list, this is not an Arraylist, but a chained list, for this I am creating a method as below:…
-
3
votes2
answers472
views@Autowired bean in Filter
I’m trying to inject a bean in a filter but without success, the same always remains null causing error. Below follows the code of bean: @Named @Scope("session") public class LoginBean { Of filter:…
-
3
votes1
answer741
viewsUpdate all schemas with multitenancy architecture
Good morning. Next, I have a multitenancy application using Hibernate with JPA. We recently implemented the multitenancy architecture and persistence.xml was configured to automatically update the…
-
3
votes1
answer514
viewsHow to know if it is mouse click or robot?
I was wondering if you could tell the difference between java.awt.Robot mouse click... I need to know if it was the Robot that clicked or if it was the mouse.
-
3
votes2
answers5853
viewsHow to decode a JSON Array on Android
The need to decode a JSON Array thus: output: [ [{ }, { }], [{ }, { }] ] I was doing it in a way that decoded a Array that way: output: [{ }, { }, { }] Code of how I was doing: Method to convert to…
-
3
votes1
answer15733
viewsHow to change the name in the android app package?
The current name of my package is com.newapp.nomedopacote. Well, in case I want to change it to com.newapp.novopacote, without damage to the application. I tried to simply make a refactor and it…
-
3
votes1
answer136
viewsInsert Selected Objects into Array
I’m doing a Formula 1 racing program, my program performs reading of various race files, and creates the objects of the race. I need to deploy in this program a class that has an array to store only…
-
3
votes2
answers1762
viewsPass JSP model to Springmvc controller
Could someone please explain to me how to correct my JSP error? This form will serve to register products in my system, it receives a list of product categories from the database. My Product…
-
3
votes1
answer81
viewsDB oracle Closed Connection
Introducing I am developing an application and have to add data to an oracle database that is local. Using JDBC I connect try (Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@" +…
-
3
votes2
answers243
viewsHow to make the program recognize ' x ' as multiplication?
It has how to treat x as *, because the user will type x to multiply a number, it would be like the program to recognize x as multiplication via the code? example double b = 5 x 5;…
-
3
votes2
answers60
viewsInnerclass object is created at what point?
I have a class which contains an Innerclass, I wonder if at the moment I give new ClassePrincipal() Innerclass is also created?
-
3
votes1
answer220
viewsCompetition problem in java web application
Good evening, everyone, See the following code: Controller @WebServlet("/testConcurrency") public class TestConcurrency extends HttpServlet { private static final long serialVersionUID =…
-
3
votes1
answer790
viewsHow to open a GUI built in Eclipse by Netbeans?
I have a code using JFrame, but when I open it in Netbeans I can only change the layout by code. How do I use the code and edit the layout by the Swing.
-
3
votes1
answer1738
viewsLazy Load Onetomany
Hello. I’m having trouble getting my relationships fetch = Fetchtype.LAZY to work with the @Onetomany annotation. In my Notafiscal entity, there are several lists fetch = Fetchtype.LAZY, when…
-
3
votes1
answer2318
viewsin the eclipse how to generate a project jar aquivo?
In eclipse how to generate a file .jar of the project to use in another application
-
3
votes1
answer1419
viewsAPP Communication with Web Server
I would like to know the best way, in terms of security/performance, to make my mobile/android application communicate with a web server (apache/php, for example) to receive/send data. The idea is…