[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More







Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

Share tech news, updates, or what's on your mind.

Sign up to Post

How do I give java more memory for issue with :

"ERROR resultset
Exception in processing the request (4) : java.la
ng.OutOfMemoryError: Java heap space"

I'm on a server that has 16GB memory and most of it is not being used at all.
I see that everytime the java.exe gets around 300MB the entire application will crash, the and tomcat says things like
"ERROR resultset
Exception in processing the request (4) : java.la
ng.OutOfMemoryError: Java heap space"

etc etc

How can this be expanded?
Amazon Web Services
LVL 12
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Java version of this scala example

I need the java version of play framework with pagination...

Below is the scala version for reference

can someone help me with the java version or converts this to java?

Hello Sirs,
I am developing a JavaFx/Spring application. Can someone help understand this exception and how to avoid it?
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
	at javafx.stage.Window$TKBoundsConfigurator.apply(Window.java:1274)
	at javafx.stage.Window$TKBoundsConfigurator.pulse(Window.java:1290)
	at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:378)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
	at com.sun.javafx.tk.quantum.PaintCollector.liveRepaintRenderJob(PaintCollector.java:320)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$ViewEventNotification.run(GlassViewEventHandler.java:788)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$ViewEventNotification.run(GlassViewEventHandler.java:749)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleViewEvent$368(GlassViewEventHandler.java:828)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleViewEvent(GlassViewEventHandler.java:827)
	at com.sun.glass.ui.View.handleViewEvent(View.java:539)
	at com.sun.glass.ui.View.notifyResize(View.java:875)

Open in new window

I am looking for support to help me with Java coding questions. I need to create a private instance variable of type String called password and then edit a constructor so that it initialises the password instance variable to the string "Adminadmin1". Finally, I need to write a getter method for the password instance variable.

Is anyone able to provide support?
Hello there,

I want to restart my java application which is running on Ubuntu 16.04 as service. But the problem I have is on Ubuntu when I want to restart my java application service, I do as follows
sudo service myapp restart

Open in new window

and then Ubuntu asks for password. Now how can I tell Ubuntu to not ask password when I send this cmd from my application.

//Restart application server
		router.get("/restartAppService").handler(ctx -> {
			/* Build command: sudo service AooService stop */
			  final ArrayList<String> command = new ArrayList<String>();
			  command.add("sudo service TutisService restart");
			  System.out.println("CMD ----"+command.toString());
			  final ProcessBuilder builder = new ProcessBuilder(command);
			  	try {
				} catch (IOException e) {
					System.out.println("EXCEPTION WHILE RESTARTING SERVICE----"+e.getMessage());

Open in new window

Any help will be appreciated!!

In java i see several places that the
line count++
is actually internally translated into three steps :
var tmp = count
tmp = tmp +1
count = tmp

So there is a posibility of race condition when updating a variable like this because the operation is not atomic.
I have the following question
1) At what step does it get translated into three steps ? Does it happen when we compile the code or at runtime ?
2) Are these operations like tmp = count assigning it and tmp = tmp + 1 atomic ? Can we surely say they are atomic or they may also be divided into further steps.

What does @GuardedBy annotation means ?
Is it only for readability ?
Does java enforces it ?

import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;

public class Guarded {
  private Object lock = new Object();

  @GuardedBy("lock") private static int nextValue;

  public int getNextValue(){
    return nextValue;


Open in new window

I wrote the above code in which the variable is GuardedBy the lock object...and then accessed without directly inside a getter.
It didnt show any error. Also it ran properly when writing or accessing the value inside the main method

I need a server side pagination example with front end with datatable with play framework i.e controller and mode layer.

Please kindly help me with a correct reference or example or source code for the best practice ?
I have a dynamic web project ( SOAP web service), which takes parameters from a received message and inserts data to oracle db. This all works fine. However, db connection url, password and user are hardcoded.

This web app will be distributed to a number of servers with different db connection details, so it can't be hardcoded and generating a new app for each server is not an option.

I wonder if I could store needed info in an xml file and read from there. Is someone able to give me a nice simple example of how to do it?

Also, where such file would have to be placed, bearing in mind it would have to be possible to edit it after the deployment?
Please guide me to solve this problem. I'm setting up Zimbra Collaboration Open Source as service provider (SP) and simplesamlphp as Identity Provider (IdP). I have installed samlextn.jar in /opt/zimbra/lib/ext/saml/ and configured SAML authentication for Zimbra server.

Zimbra server environment:

[zimbra@devzimbra ~]$ zmcontrol -v
Release 7.2.0_GA_2669.RHEL6_64_20120410002025 CentOS6_64 FOSS edition.
[zimbra@devzimbra ~]$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

The problem is after successfully authenticate in IdP and redirected to http://devzimbra/service/extension/samlreceiver, I'm getting this error in browser:

Problem accessing /service/extension/samlreceiver. Reason:

    Unparseable date: "2018-12-13T09:48:09Z"

In /opt/zimbra/log/mailbox.log:
2018-12-14 10:51:31,149 INFO  [btpool0-13://devzimbra/service/extension/samlreceiver] [] extensions - Error in validating SAML response
java.text.ParseException: Unparseable date: "2018-12-14T02:51:14Z"
    at java.text.DateFormat.parse(DateFormat.java:337)
    at com.zimbra.cs.security.saml.SamlResponseHandler.validateSamlAssertion(SamlResponseHandler.java:231)
    at com.zimbra.cs.security.saml.SamlResponseHandler.validateSamlResponse(SamlResponseHandler.java:186)
    at …
Build an E-Commerce Site with Angular 5
LVL 12
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

A high school student needs help learning Java.  I first looked at books by PeachPit Press, but they are all 16+ years old.

Can somebody recommend a great visual guide for a beginner, or some links?

I am going to try and help.  I've been programming for a  L  O  N  G  time.  My latest was PHP.  I figure I could learn along with the student - at least i have the coding mentality.

Hi Team,

This is a very simple question related t strings in JAVA .  I know String Objects are immutable and JVM maintains  a copy of the string literal in String constant pool.

But my question is with respect to this context..

String str =" Hello"   ;    --> It is stored in SCP
String str1 = str + "Wellome to Strings"  ;

When  I issue this statement , does the java compiler stores the string Welcome to Srings in SCP and at the runtime , create a String Object  in heap after concatenating Wellcome to Strings with value stored in the variable str and make a copy of this string in SCP.
Is it possible in Java to connect to the bitcoin.de websocket?
Here is Python 2.7 / Twisted

It is hard to understand what exactly should be sent to bitcoin.de to make it upgrade to WebSocket.
Dear Sirs,
I am trying to include a module to change password in my application, and stay logged in with the new password.
This is my code, after successful password update in the table
Authentication oldAuth = SecurityContextHolder.getContext().getAuthentication();

		ApiAuthUserInfo userInfo = appUtilHandler.getApiAuthUserInfo(request);
		ApiEntity apiEntity = restService.doChangePassword(userInfo, apiBeanUser);
		success = (apiEntity != null && apiEntity.isSuccess());
		if (!success) {
			result.addError(this.doHandleFieldError("oldPassword", apiEntity.getMessage()));
		// Validity Test
		if (result.hasErrors()) {
			return this.doHandleInitFormView(model, entity, success, 
					this.getViewTitle(request), AppViewHandler.VIEW_CHANGE_PASSWORD_FORM_ENTRY);
		final  UserDetails userDetails = new ApiAuthUser(
				apiBeanUser.getCode(), apiBeanUser.getNewPassword(), oldAuth.getAuthorities(),
		Authentication newAuth = new UsernamePasswordAuthenticationToken(userDetails,
				apiBeanUser.getNewPassword(), oldAuth.getAuthorities());

Open in new window

After I do this, the next page refresh or even the next log out, gives an UNAUTHORIZED ERROR Message, until I manually reset the password to the former one.
The impression I have is that the new password didn't get updated in the Authentication.
What am I doing wrong?

Any help will be appreciated.
I have to create the following table in postgreSQL :
create table rbl_kyc_profile (
  id int8 not null,
  userid varchar(50) not null,
  kyctype enum ('PAPER','E_KYC','MINIMAL','SHORTFALL')

Open in new window

I got an error : SQL Error [42704]: ERROR: type "enum" does not exist
I saw on postgreSQL documentation page : https://www.postgresql.org/docs/9.2/datatype-enum.html
That one first needs to create an enum type in postgreSQL.
This is very different from MYSQL where you can just create a column of enum type by specifying the values...
I have the following questions..

1) Since the kycType in my java classes is an enum. And it has a fixed set of values should i create an ENUM in postgre for it or just create a varchar for it ?
2) Because postgreSQL uses enum types in a different way than MySQL does what impact it has if i create the above kycType as an enum type and then use it in the table ?

How do you build a distributed system in Java? I want to distribute a stream on multiple nodes.

I've started with Java RMI. It works, but rmiregistry is an unwanted complication. Is there something better in Java, without rmiregistry?

I figured the system needs a dynamic leader election, so now I have the bully algorithm implemented with RMI. When multiple instances are executed to represent nodes, they correctly vote and elects the leader, including handling of reelection when some of the nodes fails or disconnects.

Now, I'm not sure how to distribute stream processing on multiple nodes.
I can have one or more streams, and one or more operations to be performed on the streams.

I want he leader to be the central task allocator. The leader node should distribute tasks on nodes and monitor the progress.
Distributed systems typically use some partitioning of data.

I'd expect distributed stream processing to have some well-known architecture, but somehow I can't find it. It's probably going to use the same components as every other distributed system. (Well, a scheduler - that's the central task allocator,  a partitioner - to partitoin the data perhaps using some hashing function, leader election - done, ...)

With your answer, it should be clearer how to distribute an event stream on multiple nodes.
Spring Boot Project Conversion To Web Project - External Tomcat

We have a project developed using Spring Boot. Basically developed the back-end code developed and tested via Rest API.

Now, we have done the front end html and other pages separately.

Now we are not sure how to integrate this project as web application and deploy automatically via Maven in Tomcat

  1. Need to know the project structure for web application project for Spring Boot
  2. Where to place the jsp, javascript, html, css, log4.properties file in spring boot
  3. How to automatically bundle the project and deploy as a war so that we can deploy in any tomcat externally instead of going for a Spring Boot Embedded tomcat.

Current issue: when we deploy the html files manually  the controllers are not recognized

What are the configurations needs to be done when we hit a page via html. Ex: login.html

Please advise.

I am having issues getting Browser print working with Zebra label printer.  I am able to access the printer and it is printing however,  using IE 11 on the website 3PL Warehouse Management it will not print.  I know silverlight and java play a part in this however I believe it's the browser print software that is causing the issues.  We cannot use chrome or Firefox.  Has anyone ran into a fix for this?  3PL stated it might be a firewall issue however, it is not.  Please advise if you can thank you
Spring Boot - Ethereum Sample Maven Project

I'm looking for a Spring Boot with ethereum Sample Maven Project.

Looking for a good reference?

OWASP Proactive Controls
LVL 12
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Assume application should have excel kind of grid. Assume 30 columns. Out of which 10 columns will have ranges to filter like in excel we can create greater than or less than or equal etc.,

We need to build an application for the above.

How to do that in Java? Do we have a good open source third party already available in java for the above to integrate with an application?

Is there any website where one can post there understanding of computer science concepts or explain them and then user can ask questions. Although expert exchange also has article section.
But i want to specifically do it for Java concepts Java 8 features etc.
The idea is to feel motivated to study it... as it helps learning the material in a quicker way
Any alternative suggestions
how to use copyright symbol and trad mark symbol in rest api call (I need to pass  one of the Json parameter )

I need to get it in Java code and save the values in DB .

Any one have idea on this ??
How to do server side pagination for a Angular with Play framework application ?

Looking for a very good example with source code

Please kindly advise.
There is following code -
   public CompletionStage<Void> addEmail(Long userID, String email) {

      CompletableFuture<GetMappingResponsePayload> getMappingResponsePayloadCompletionStage =
              (CompletableFuture<GetMappingResponsePayload>) addressResolver.getEmailMapping(email);

    return addressResolver.addEmailMapping(email, userID)
        .thenCompose(__ -> emailsDao.upsertEmail(userID, email, true));

Open in new window

I want to fetch the object GetMappingResponsePayload from above.
The getEmailMapping function is a synchronous call so when the code gets executed the result will be there.
To give the context there is a Boolean attribute inside GetMappingResponsePayload and based on that
i want to return an exceptionallyCompletedFuture in case the value is false.
otherwise the next return statement is executed.
How do i achieve this neatly

Hey all I am trying to send out an outlook email from Java using the JACOB COM activex code.

This is currently my code:
import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;    
import java.util.HashMap;
import java.util.Map;

public class MailOut implements com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {
    Map<String, Object> params = new HashMap<String, Object>();
    String attachment[] = new String[1];
    String to[] = new String[1];

    public MailOut() {

    public String exec(ITestExecutionServices tes, String[] args) {
        params.put("subject", "Test subject");
        params.put("body", "Please see attached.");

        attachment[0] = "C:\\temp\\about_blank.pdf";
        params.put("attachments", attachment);

        to[0] = "me@here.com";
        params.put("to", to);

        OutlookJACOB mail = new OutlookJACOB();

        return "";

    public class OutlookJACOB
        private ActiveXComponent ol;
        private Dispatch outlook;
        private Object mapi[] = new Object[1];
        private Object email[] = new Object[1];

        public OutlookJACOB()
            mapi[0] = "MAPI";
            email[0] = 0;

            ol =

Open in new window







Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.