java

java

  • All Sites

2 answers

find the occurence of all vowels in a sentence

I am writing code that find all vowels 'a' 'i' 'u' 'e' 'o' in a sentence that I write and count them. The code will ignore the case of the vowel(upper or lower). Since I don't know how to make the ...

2 answers | 35 secs ago by NumbNuts on Stack Overflow stackoverflow.com
2 answers

Hibernate - One to Many associations

i have two tables, ComputerNode and Connection. ComputerNode has a primary key nodeid but Connection do not have one. I can't modify the table schema. How should i create the java POJO if they were to ...

2 answers | 2 mins ago by nuttynibbles on Stack Overflow stackoverflow.com
0 answers

Servlet response invalid format data

I have created a servlet to response request. The issue is the server response invalid format data. My code: String charset = "UTF-8"; request.setCharacterEncoding(charset); ...

1 answer

andorid project-> MainAcitvity.java - R cannot be to a variable

Here's my MainActivity.java class generated as I create android project - there's variable R which isn't defined anywhere. I didn't modify this class at all. What should be this R varaible assigned to ...

4 answers

Incrementing variables

I understand the difference between post-increment and pre-increment, but I don't understand this: int b = 1; b = b++; System.out.println(b); // --> 1 Why does this print 1? Isn't b incremented ...

4 answers | 5 mins ago by mn8r on Stack Overflow stackoverflow.com
0 answers

How to make a method to refer only to the instance of a class given as a parameter for the method?

I'm required to make a quick fix on a class, where a method, that processes files on a dropzone and mails them with a press of a button, gets a Dropzone as a parameter. However there's a bug that ...

0 answers

Extract Images from PDF using pdfbox library java

I want only images at their respective positions as in the pdf with its exact layout but I don't want text to render in it Is there any way to do it currently I am working in this way but text also ...

1 answer

Spring boot controller not invoked by Tomcat

I am working on a web application using (spring boot) .The problem i am facing , application is running (run as a springboot) fine from eclipse but when i deploy project war in tomcat 7 its giving me ...

1 answer

Session Tracking using Stuts2

Good day. This is my first time developing a web application. I am using Struts2 Framework and an apache tomcat 6 server. Given this following code: index.jsp <s:form action="login"> ...

1 answers | 10 mins ago by Rjmr on Stack Overflow stackoverflow.com
2 answers

How to get Hibernate dialect during runtime

In my application, I use Hibernate with SQL Server database, so I set <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"> in my persistence.xml. In some case, ...

0 answers

How to allow decryption with the wrong key to complete without throwing a BadPaddingException?

I'm in need of a simple AES cryptosystem in ECB. I have one working at the moment in the sense that given the same key twice in a row, it will correctly encrypt and decrypt a message. However, if I ...

1 answer

Synchronizers between two different execution blocks

Message-processing-task should stop processing a NEW message when it detects a client-login-task. However, the message-processor should complete the task it was processing before pausing. This ...

4 answers

Why 'String' objects are immutable with an explicit constructor in java?

It make sense to make class String objects immutable with following declarations, because they share the same storage in common pool. String str1 = "abc"; String str2 = "abc"; But, am not sure, if ...

1 answer

Uploading File in DAM Programmatically using AssetManager? What MimeType should I use?

I have a form that uploads a File to a SlingServlet. The SlingSerlvet receives the file and it tries to save the file in DAM using com.day.cq.dam.api.AssetManager.(i.e. Save file in DAM ...

1 answers | 13 mins ago by Oliver on Stack Overflow stackoverflow.com
0 answers

Upload file using selenium web driver

I am doing practice of selenium web driver. I am using this form for practice : http://www.toolsqa.com/automation-practice-form/ Now , I have 3 issues in that. 1 - There are first 2 links called ...

8 answers

Is there an beautiful way to assert pre-conditions in Java methods?

A lot of my functions have a whole load of validation code just below the declarations: if ( ! (start < end) ) { throw new IllegalStateException( "Start must be before end." ); } I'd ...

8 answers | 21 mins ago by Salim Fadhley on Stack Overflow stackoverflow.com
0 answers

CQ5 Remove Render-Blocking JavaScript

I'm working on this document to remove blocking js: Remove Blocking JS However with CQ5 we include js via: <cq:includeClientLib js="headlibs"/> How can I modify script tag like: ...

2 answers

delete button is creating dynamic event in selenium…delete is not like a button.its like an icon in my site..how to solve this?

I am using selenium for automating my site.my site is an administrative site that add roles and delete them as well,there is an add button at the top to add the roles, but delete button is present in ...

0 answers

Java background server class that might be called from ui thread

I have a server communicating over network interface. This server should run on a background thread, so that it does not block the ui thread. The ui thread starts and stops the server. Even starting ...

3 answers

Coding on interfaces/superclasses not implementations

From pretty much any book I've read it always said to code on interfaces/superclasses and rarely on implementations, today though that advice made a bit confused about how I should format my code. ...

1 answer

Is it possible to create your own custom font by using Java?

I have a font-made image and I'm curious, is it possible to convert it into real font in Java? (e.g .ttf form). I don't find any "how to" for this.

1 answers | 25 mins ago by Vincentius on Stack Overflow stackoverflow.com
0 answers

What is the jasperrepots-fonts jar for and how to use it?

i'm evaluating JasperReports for report generation. I have some problems with report portability between Windows and Linux. I found a (hacky) solution to make it work cross platform. However i wonder ...

2 answers

how can I debug a jar at runtime?

I'm into a quite strange position (from my java-newbie point of view): using Eclipse I wrote a "java program" (some .java files with classes into) which essentially (batch) reads a text *.csv file, ...

3 answers

How do I restrict the range permitted for the int argument of a method

Say I have a method: public void method(int i) { this.value =+ i; } How can I restrict i to a value greater than x? I understand this can be done outside the method but I would prefer to ...

3 answers | 27 mins ago by user2760045 on Stack Overflow stackoverflow.com
3 answers

Access classes of another project-java

I am writing an application in Java and i have two projects say P1 and P2 . I want to access classes of P2 in P1 and access classes of P1 in P2. I have tried adding P1 in P2's build path and vice ...

3 answers | 27 mins ago by user2779627 on Stack Overflow stackoverflow.com
0 answers

Can we use offline google maps in java desktop application?

I want to know if there is a way to have "google maps" embedded "in a java desktop application in offline mode"? I want user to be able to zoom in and zoom out in the maps. And the application will ...

1 answer

Send data from server to an Android app

How can I send data using sockets from a server to an Android app to display it? My Android app takes a photo and sends it to a server located on a PC to stored it and detect how many faces has the ...

1 answers | 29 mins ago by ArCiGo on Stack Overflow stackoverflow.com
2 answers

Eclipse E4 - IEclipseContext usability

Hello I'm using (in the Core Expressions) an IEclipseContext object in order to store a String thru its .set method. IEclipseContext mycontext; mycontext.set("mystring","com.test.test2"); By the ...

2 answers | 29 mins ago by unclejohn00 on Stack Overflow stackoverflow.com
1 answer

Nothing happens when running GUI

I'm doing a project for my class and I'm working on the GUI right now. I don't have much because, well, it's not showing up and it's infuriating. Here's my code. public class BookQuizGUI extends ...

1 answer

JFrame, JPanel, paintComponent how to

Hi I have following classes, I want display content (paintComponentor that panel with this rectangle from paint class) inside my JFrame. I try already find out how to achieve this by looking at ...

15 30 50 per page
1 2 3