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
answers5487
viewsProblems with installing Android Studio on Fedora Linux
A few days ago I try to install the Android Studio editor on Fedora linux and I can’t. I searched in some tutorials, websites, google and could not find a solution to deal with the error below:…
-
3
votes3
answers166
viewsForm waiting for a request
Problem My form makes a statement requisição a database (select, insert, update, delete values), but whenever these requests are made a lock occurs in the form (a freeze)! How to prevent forms from…
-
3
votes2
answers50
viewsBusiness Exception is not in the Clientejb classpath
I have the following situation: EJB PROJECT public BussinessException extends Exception {} public MyInterfaceImplementation implements MyInterface {} EJB PROJECT CLIENT public interface MyInterface…
-
3
votes1
answer299
viewsHow to receive a list of Strings in a Struts2 select?
I have a select on my page that should have its value and caption populated through a list of Strings that come from my Action. I am sending the list correctly, because I see the combo have the…
-
3
votes2
answers226
viewsError performing Insert on an Android application: "Empty bindArgs"
Explanation: I have an android app that was made using the ADT (Android Developer Tools) I use the bench sqlite and eventually perform some operations such as insert or update and also some…
-
3
votes1
answer201
viewsWrite HTML in JSF - Frameworks fonts?
I see in several code examples the views using those tags jsp, what I find very ugly and dirty. Are there any java web framework that is used in app corporate and can give me normal html, without…
-
3
votes1
answer1060
viewsSchedule Tasks with Timer
Situation: Description: I have this Timer to perform my tasks in a certain period of time according to the seconds informed. Problem: When running the program the tasks starts by ignoring the…
-
3
votes3
answers250
viewsJava 8 + Android
You can use the full potential of the Java 8 API (lambda queries and etc) on Android systems? If yes, it’s worth the migration?
-
3
votes1
answer599
viewsStandard Java design for code reuse
I am developing a simple program in Java Desktop using SqLite to store local data, I would like to know which design pattern I can use to reuse the codes Java to develop the same application for…
-
3
votes2
answers307
viewsEnd of Java Scanner input
This C code reads integers until Control-Z is typed (end of windows entry). void main(int argc, char *argv[]) { char line[100]; int sum = 0; while(scanf("%s", line) == 1) { sum += atoi(line); }…
-
3
votes3
answers1702
viewsIs encapsulating the properties file in a class a good practice?
In other languages like Python it is possible to perform programming logic in the configuration files and in Java this is not allowed because it is a compiled language. I decided to encapsulate the…
-
3
votes2
answers1288
viewsHow to store checkbox status
I’m developing an application to make a school call list, I created the Listview and populated it with data from a database Mysql, using Json. The problem is this, I need to store the status of…
-
3
votes1
answer703
viewsPicking up Timeinmillis and using Timestamp
Doubt: I know two ways and capture one TimeInMillis() does anyone know the difference and what is the most efficient? What if there is a third way to capture that value? Option 1:…
-
3
votes1
answer2624
viewsHow to separate a PDF file line by line, in Java?
I need a way that I can read line by line from a pdf file. I am reading the entire pdf file at once on this command line: String conteudo=PdfTextExtractor.getTextFromPage(reader, 1); However I need…
-
3
votes2
answers21001
viewsHow to resolve java.net.Unknownhostexception error
I’m trying to install the sqldeveloper and datamodeler in my Fedora 20 and I’m having trouble with following error: java.net.UnknownHostException: localdomain: localdomain: Name or service not known…
-
3
votes1
answer122
viewsProblem on Jcalendar-1.4 display
Hey, all right, guys! I’m creating a program and I’d like him to have a calendar on the main screen. I searched and found jcalendar-1.4, however, when adding it some numbers are not shown (they have…
-
3
votes1
answer971
viewsHow to recover a soapObject from a return from the webservice
androidHttpTransport.call(SOAP_ACTION4, envelope); SoapObject result = (SoapObject) envelope.getResponse(); System.out.println(result.getProperty("nmConsultor")); return result.toString(); In case I…
-
3
votes1
answer333
viewsWeb Service Testing with Arquillian
I’m doing a unit test class and I’m using Arquillian because of CDI, in this case I’m testing a Web Service for authentication of company users. Follows the source of the test class:…
-
3
votes1
answer967
viewsCount Scanner lines
I wonder if someone could explain to me how to count the lines of a Scanner text so that after counting them I can go back to the starting line?
-
3
votes1
answer1549
viewsHow to write a file to ISO-8859-1 without losing accentuation
I would like to know please how to save a file to ISO-8859-1 and not to miss the graphic accent if possible, my doubt comes from the following. When defining in Eclipse that the file encoding…
-
3
votes3
answers8309
viewsWhat Java byte serves
What is the byte type of java for? ex: byte[] dados = ... ; What’s the real use? Does anyone have an example?
javaasked 10 years, 6 months ago felipe.rce 1,969 -
3
votes1
answer1708
viewsHow to create a project with JSF, Primefaces, and Tomcat running in Eclipse and Netbeans at the same time?
How do I create a Maven project with JSF, Primefaces, and Apache Tomcat so that it runs on both Eclipse and Netbeans without problems? (Preferably with the latest versions of the technologies)?…
-
3
votes1
answer377
viewsHow to ensure that a Servlet is Deployed in Tomcat 7 using Servlet Container 3.0?
I am developing an application that uses the Servlet API 3.0 via Annotations and porting does not need WEB-INF/web.xml file The problem that sometimes when I deploy in Tomcat 7 the Servlet is not…
-
3
votes2
answers1252
viewsJPA, Oracle and Exception Handling
I am using vraptor 4, JPA and Oracle. But when an exception occurs during persistence the error code that Oracle generates is not coming along with Exeption. This is the Repository @Repository…
-
3
votes1
answer359
viewsSlow search for Hibernate Search index
That’s a crosspost that I did in the stackoverflow in English. It is difficult to understand (and correct) this problem. I’ll put it here to see if anyone in our community has been through this and…
-
3
votes2
answers3052
viewsHow to work with Postgresql array data types using Hibernate
How to perform object recovery and saving using type columns array using the Hibernate? In my case I want to save String. How I define in model the object? I found it on the net some examples but…
-
3
votes1
answer460
viewsProblems installing jdk7 or 8 on MAC OS 10.6.8 - Snow Leopard
I’m a beginner in java, and I have a Macbook with MAC OS X 10.6.8 better known as Snow Leopard. I’m trying to install jdk and Netbeans on it and I can’t. He tells me I need version 10.7 of MAC OS. I…
-
3
votes2
answers3658
views"Connection refused" error when connecting to Postgresql
Error happens after entering login and password: "Deuorg.postgresql.util.Psqlexception: Connection refused. Check that the hostname and port are correct and that the postmaster is Accepting TCP/IP…
-
3
votes1
answer210
viewsObject instantiation failure: only the first is created
I have a class in JAVA which is a Server. I put in this server class the port argument, for example. If I were to call this class I would do so: new Servidor(5000);. 5000 is the argument of this…
-
3
votes1
answer121
viewsAndroid getDeclaredFields value
I’m doing some studies of android, I don’t know much of the subject because I’m starting now, I would like to create a simple mvc of CRUD, where I want to call model.save(); So I created the…
-
3
votes2
answers1597
viewsPrimefaces, button requires two clicks to perform action
While executing the code below, I have to double click on the button so that the delete action happens I saw many with similar problems, but no effective solution: <h:form id="TablePais"…
-
3
votes1
answer112
viewsHow to search for . exe?
How do I make a Java application that searches for a ". exe" inside a folder and inside that folder has subfolders. I want it to search for me even if I have subfolders. And it returns true or…
javaasked 10 years, 5 months ago Júnior Nascimento 679 -
3
votes2
answers1026
viewsLoop with options
How do I create a loop with options in Java? For example: "type 1 to save and 2 to delete". And when doing the commands for each option, go back to : "type 1 to save and 2 to delete". import…
-
3
votes2
answers2257
viewsHow do I get the class name in a static context?
i want to get the name of the class that called my method class A { public static String getClass(){ return getCalledClass(); /*Supondo que exista esse metodo*/ } } class B extends A{ } When I do:…
javaasked 10 years, 5 months ago Vagner do Carmo 600 -
3
votes2
answers4019
viewsCalling Java method in Javascript
I have a problem, and I needed to call a Java method inside a Javascript file. Java example: public void Inserir(User user) { //insere usuario } Need, via a file . js, send the object to the Java…
-
3
votes1
answer683
viewsGet cookies from an Httpclient login on android
I do a post with android and Httpclient on a page, but I need to know a way to get cookies from that connection. this is the code I use to make the post public static void postData(Activity…
-
3
votes1
answer701
viewsHow to not filter only a folder in JAVA - Filter
I’m using a class inherited from Filter in Java to do login control. I did the mapping on Web.xml as follows: <filter> <filter-name>ValidacaoLoginFilter</filter-name>…
-
3
votes3
answers528
viewsRead file only by Java Android application
I’m making an application that reads images from a folder, but I have a problem, I need to prevent other applications (ex: gallery) and even file manager can open this image... How do I get only my…
-
3
votes1
answer107
viewsSocket with Timertask
I want to request the serverSocket a response (some information) every 5 seconds. I rode my socket and I’m wearing a TimerTask to execute a method every 5 seconds, but only the first execution is…
-
3
votes1
answer1155
viewsCalculator - operations with decimals
Once again I show up with this calculator here, I’ve been helped a lot with it and it’s almost ready! It’s working all operations perfectly, no mistakes whatsoever, except for one small detail... it…
javaasked 10 years, 7 months ago Gabriel Ozzy 545 -
3
votes3
answers7392
viewsCreate an object from another class
I own the class Endereco and the class Cliente, I built 2 builders for the Cliente, and in one of them is to be inserted the name of the client and an object of type Endereco, which works perfectly,…
-
3
votes1
answer432
viewsHow to recognize Mysql instances using Java and allow the user to choose the database?
I am developing a project that is requested that it is possible to access different benches of MySQL which are allocated on machines and also on servers. In a way that allows the selection of a…
-
3
votes1
answer1064
viewsI can’t connect Jpa to Postgresql at all
Good I’m trying to connect the postgresql, however, without success. My application will be an application jsf and so I’m using persistence. <?xml version="1.0" encoding="UTF-8"?>…
-
3
votes1
answer168
viewsAndroid Widget - Permission Denial
I’m having a permission problem that’s gone a little overboard. Inside a widget I inserted a button, that when pressing I receive the following message: 04-13 14:10:44.340: E/databaseutils(2362):…
-
3
votes1
answer474
viewsHow to give a EXECUTE IMMEDIATE command on an ORACLE database from a JAVA application?
The error is when I execute: execute immediate 'update teste set num = 1234 where num = 1'; Exception: java.sql.SQLSyntaxErrorException: ORA-00900: instrução SQL inválida…
-
3
votes1
answer856
viewsSpring MVC in HTML pages without JSP
1 - You can use data sent by Spring Controllers in HTML pages (using HTML5 tags), not to use JSP? 2 - If not possible, how can I make JSP pages with Spring MVC with minimal Java code intrusion on…
-
3
votes4
answers7507
viewsArduino and Android Bluetooth Connection (Java) - Inputstream storing old data
I’m making a class in Java very simple, just to simulate the communication of Android with Arduino via Bluetooth. The idea is the following: The Arduino every 5 seconds will light and erase an LED.…
-
3
votes1
answer5449
viewsChange text from Textview to an Android Fragment
I have a TextView within a Fragment (a tab). How do I change the text of this TextView? Here it is giving NullPointer qtAllImagensLabel = (TextView)findViewById(R.id.qtAllImagensLabel);…
-
3
votes1
answer650
views"Listen" directory using Java
I am working on an application, and I need to create a functionality, as a method, that is "listening", given directory. The directory is used as a destination for *.xlsx file uploads. I need that…
-
3
votes2
answers972
viewsEncryption with Java
I need to encrypt the data in a user authentication session, and I would like to know the best, most secure way to work with Java encryption. Is it using Salt, MD5, AES, SHA, or other? Which API’s…