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

Looking for link where all java related working applications are available or displayed or listed.

github has many projects however hard to find the working applications as many are sample ones and not updated to uptodate and no support if the project doesn't work.

Cloud Class® Course: CompTIA Healthcare IT Tech
LVL 12
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.


i saw above kind of lines of code in junits

what is java() means

is it new in java 8 which i never heard of?

please advise
what are differences between eclipse short cuts F3 and Control +Shift+G
when to use which one?

Please advise

I'm working on a java project where the build is done using maven. The final war/jar size seems to be very big.

When the war/jar size will be increased? I am not sure how to reduce the size of the jar.

How to build only the jars required for the project?

Currently we just given maven build plugin in the dependencies and artifact id on the top which builds the war or jar

Please advise.

Hello Experts,
Just wondering if there is a any opensource JAVA JAR file that I can use for a project that allows me to connect to a DB (like mysql or H2), create tables, insert data into tables, etc. Basically, I am looking for a solution which builds the queries itself when data is passed as parameters to a method. Any inputs really appreciated.
We only increment by 1 the matrix table when we encounter 1 only if the entire proceeding row has zero and the entire succeeding row has zero. If there is something like this 0,1,1,1,1,0 then we increment only 1 not four times. zero represents none in the matrix table so for instance if the entire succeeding row is and the current row is 1  then in matrix table we want to increment the index where the row is none and column is column1.  I have written some code but it only happens to increment for one column.

I have attached a file with data.
import java.util.Arrays;
import java.util.Scanner;

public class Incrementing {

    static String[][] resultMatrix = new String[30][30];

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        int n = 0;
        //in_data1 is used to read a line from the file
        String in_data1;
        //in_data2 is used to read a line from the file after in_data1 line
        String in_data2 = "";
        //in_data1_arr array is used to store the data from in_data1 split by ","
        String[] in_data1_arr;
        //in_data2_arr array is used to store the data from in_data2 split by ","
        String[] in_data2_arr;
        //this is the array which has 34 indices in which we increment the the index which satisfy the condition
        int[] count = new int[34];

        // display output matrix …
I am tring to decrypt a excel file but there is an error occur Input length must be multiple of 8 when decrypting with padded cipher

private String decrypt1(InputStream encrypteddata) throws IOException, IllegalBlockSizeException, BadPaddingException {
        try {
            byte k[] = "NiTh5252".getBytes();
            System.out.println("Encrypted Data stored in byte k: " + Arrays.toString("NiTh5252".getBytes()));
            byte[] bytes = IOUtils.toByteArray(encrypteddata);
            System.out.println("Encrypted Data stored in bytes: " + Arrays.toString(bytes));
            SecretKeySpec key = new SecretKeySpec(k, "DES");
            Cipher enc = Cipher.getInstance("DES");
            enc.init(Cipher.DECRYPT_MODE, key);
            byte[] textDecrypted = enc.doFinal(bytes);               ///error in this line
            System.out.println("Encrypted Data stored in textDecrypted: " + Arrays.toString(textDecrypted));
            System.out.append("Decrypted Text is :" + new String(textDecrypted));
            return new String(textDecrypted);
        } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) {
        return null;

Open in new window

I have deployed my code on two machines M1 and M2.
They fetch a USer Object which contains details about name, designation, emailID etc corresponding to a userId.
Currently i am storing them in cache like this :

    private Cache<String, User> userCache;
 userCache = CacheBuilder.newBuilder()
                .expireAfterWrite(60, TimeUnit.MINUTES).build();

Open in new window

But i just realized that there will be two caches on M1 and M2 separately. That could be an issue because say M1 caches data for a user. But the load balancer than sends the request to M2 and it will have to again fetch data.
what are the possible solutions to this ?
I can think of keeping another machine with all the cache data in RAM.
And so create a cache on M1 and M2 that programmatically connects to this machine.
But then comes the problem of having one more replica of this machine because in case one is down then
we still have data access...
Please suggest what is used to solve this type of problem ?

The table name will be dynamic and need to return the list of objects dynamically. The parameters also dynamic however 4 parameters will be same for any table.

Method name accepts the table name and 4 parameters required to query any table

List<?> conversations = jdbcTemplate.queryForList(
         "select * from "+ tableName + " where id=? and userName=? and
 password=? and tenantId=?" , paramsObjectArray);

tableName is a string which comes dynamically paramsObjectArray is a Object[] which comes dynamically. paramsObjectArray is of string values

ex: Object[] obj = new Object[4]; obj[0]="one"; etc.,

I'm using queryForList method with parameters to avoid SQL injection directly.

Currently the query throws invalid column type.

We are working on an e-commerce application. We are at the point of integrating Elasticsearch for the product search engine with Spring boot application with Spring data. We have tried different tutorials online (check links below) but they all doesn't run well. No indexes are added to the Elasticsearch.  We are using ES 6.3.1 and the maven dependency is as follows.


Open in new window

Product Entity

@Document(indexName = "product", type="default")
public class Product {

    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long Id;
    private String Name;
    @Type(type = "text")
    private String Description;
    private String ShortDescript;
    private String Model;
    private String Brand;
    private String Sku;
    private String Isbn;
    private Integer Shipping;
    private BigDecimal SalePrice;
    private BigDecimal RegularPrice;
    private Integer Quantity;
    private Double Weight;

//other code here

Open in new window

Product Repository

public interface ProductRepository extends ElasticsearchCrudRepository<Product, Long> {

    @Query("select p from Product p where = ?1")
    public Iterable<Product> GetAllProductsBySupplier(Long id);

Open in new window

We have installed kibana locally and have tested with test data and it works. But not with the Spring Boot application. Need your help. Thanks

Get expert help—faster!
LVL 12
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Getting "Type safety: Unchecked cast from Object to Map<String, String>" warning during the typecasting.

Could you guide me how I can resolve it?.  Please check below-mentioned code:-

Map<String, String> columns = ((Map<String, String>) map.get("columns"));
Dear sirs,
Please help, how can I avoid this exception. It happens when my http response includes an empty List in the body.

org.springframework.web.client.RestClientException: Error while extracting response for type [java.util.List<?>] and content type [application/json;charset=UTF-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token at [Source: (PushbackInputStream); line: 1, column: 1] at org.springframework.web.client.HttpMessageConverterExtractor.extractData( at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData( at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData( at org.springframework.web.client.RestTemplate.doExecute( at org.springframework.web.client.RestTemplate.execute( at at at

Please, assist
I use the RXTX to read the input from a scale device, the code is the following:

                    // configuro el puerto
                    serialPort = (SerialPort)"ListPortClass", 1200);

                    int b = serialPort.getBaudRate();
                    serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);

                    InputStream mInputFromPort = serialPort.getInputStream();

                    // antes de empesar a leer le doy un tiempo apra que se llene el buffer

                    // leo el peso
                                        byte mBytesIn[] = new byte[2048];

                                        String value = new String(mBytesIn);

                    // en caso de error cierro el puerto

Open in new window

the data format is: "000" + "000025" + "000000" + "\r\n" + ETX;

the problem i have is the string read from com port is not stable, sometimes is like "000025" + "000000" + "\r\n" + ETX;
And something is: "000000" + "\r\n" + ETX + "000" + "000025" + "000000" + "\r\n" + ETX;

how i can validate the input to avoid the misformat data and only read the correct format
I have the following code that calls a class "m", passing in a List (and a double) as follows...

my_outlier = (double) m.getOutlier(Arrays.asList(1.1, 2.1, 31.1, 4, 3, 4), 0.95)

Open in new window

Notice that the List is hard-coded.  I need to pass in a List variable somehow, but I can't get it to work. The "asList" seems to need that hard-coded list of numbers within parenthesis. Any suggestions?
I'm trying to configure LDAP authentication in my application, i'm using sprintg boot for Dev.
Here i want the end-to-end LDAP configuration includeing the User and Admin roles.

How do i do the LDAP authentocaion to maintain the roles in my application?

Thanks in Advance!
MY JMX console is down. Observed jboss services are in hung state. So, When i am trying to restart my jboss in my putty its not getting restarted and showing the below info in the log continuously......I have tried to reboot the server once - its worked. but the next day its the same issue.

 INFO  [JMSContainerInvoker] Waiting for reconnect internal 10000ms for OntarioStatusListenerBean
INFO  [JMSContainerInvoker] Trying to reconnect to JMS provider for OntarioStatusListenerBean
ERROR [JMSContainerInvoker] Reconnect failed: JMS provider failure detected for OntarioStatusListenerBean


INFO  [JMSContainerInvoker] Waiting for reconnect internal 10000ms for OntarioStatusListenerBean

Please help me with fix for this issue.
I am reading a bunch of csv files that share the same structure and I would like to skip the first three columns.
This is my code:

import java.util.Scanner;

public class Readcsv {
    public static void main(String args[]) throws FileNotFoundException {
        int n = 0;
        int[] count = new int[25];
        String fileRead;
        File file = new File("folder path");
        File[] fileNames = file.listFiles();
        assert fileNames != null;
        for (File fileNamed: fileNames) {
            Scanner inputFile = new Scanner(new FileReader(fileNamed+""));

            while (inputFile.hasNext()) {
                fileRead = inputFile.nextLine();
                for (String filed : fileRead.split(",")) {
                    if (filed.equals("1")) {
                        count[n] = count[n] + 1;
                n = 0;
        for (int c_out:count) {
            System.out.print(c_out+" , ");
Unable to send an emailjavax.mail.MessagingException: Can't send command to SMTP host;
  nested exception is: PKIX path building failed: unable to find valid certification path to requested target
Dynamic Form/Table from BackEnd for every entities which has CRUD operations

I'm developing a Java Web application.

I need to

1st option list the user clicked entity menu on the UI
2nd search page where user enter values for the fields and we need to publish the search results in a table

Note: the number of columns will differ from entity to entity

In either case, i need to know hoe to define a generic entity, pojo, DAO and DAOimpl, service and controller class and view jsp page

What should be the return type Object for #1, #2

How to create a generic jsp page to display the results for any entity

Please advise

Cloud Class® Course: MCSA MCSE Windows Server 2012
LVL 12
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

flames.txtplease rectify the below issue in java programs flames.
Flames is a program that take two string  after getting input of two string it can remove the common charter in both the String:after it can find the length of two string  and based on the length it give Some clue:that u are suggested
Generic Form, Controller, Service and Search fields for Java Web Application

I want to built an application where there will be 500 screens which needs basic CRUD operation and individual field search or combined search field option is required.

Everything when we build entity in Java/JPA we want to have separate controller, service, repository and search api.

Is any framework or open source it has all in common, where we can use the generic controller, service, repository and search and export options by default instead of writing any new code snippet

However we can extend whenever is required.

Please advise.
Online Docker creation like Online-Compilers

Below are the online compilers for several programming languages...

Do we have a similar kind of online utility to create DOCKER files with the given files or project. Setting and Installation seems difficult.

Run DART Program Online

Zero Installation to Learn/Run ANY program
I want to write a java program that loop through files in the directory and keep track of the changes from one micro pattern to another. The files contain names of hundreds of classes, in the file 0 means the class doesn’t matches a micro pattern and 1 matches that specific micro pattern. So, I want to update the matrix file every time micro pattern is changing.

For example:
Version 1 – class A record, class B function pointer, class C cobol like
Version 2 – class  A function pointer, class  B cobol like, class  C recursive
Version 3 – class  A cobol like, class B recursive, class C function Pointer
Class A is changing from record (V1) to function pointer (V2) to cobol like (V3). Therefore there is a 1 from record to function pointer, and a 1 from function pointer from cobol like:
Matrix table
                                           Record                  Function Pointer               Cobol like                    Recursive
Record                                                            1              
Function pointer                    1       
Cobol like                            

Now for class B is a function pointer in V1, then a cobol like in V2, then a recursive in V3.
                                          Record          Function Pointer          Cobol like           Recursive
Record                                                         1              
Function pointer                                                                               2       
Cobol like                                                                                                         …
I am having a java application with source code and libraries.

I would like to convert the entire java source to DART. Basically wants to convert the java application to DART Application (Java flavour) -

Can someone help me what would be the easiest way or best approach or ways to quickly convert a java project to DART project ???

All the functionalities are same and no change in the functionality of the appplication.
Hi Expert,

I'm getting below Oracle Web-logic application error could anybody please guide me how to fix it!

subsystem is initializing on Server WebWORKS6.>
####<Aug 2, 2018 1:09:38 PM GMT> <Info> <Store> <trpridrps1app6> <WebWORKS6> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1533215378092> <BEA-280008> <Opening the persistent file store "WLS_DIAGNOSTICS" for recovery: directory=D:\Manu\IDRPPSA\srvr6\config\JDADomain\servers\WebWORKS6\data\store\diagnostics requestedWritePolicy="Disabled" fileLockingEnabled=true driver="wlfileio3".>
####<Aug 2, 2018 1:09:38 PM GMT> <Critical> <WebLogicServer> <trpridrps1app6> <WebWORKS6> <Main Thread> <<WLS Kernel>> <> <> <1533215378108> <BEA-000386> <Server subsystem failed. Reason: java.lang.NullPointerException
       at weblogic.diagnostics.archive.DiagnosticStoreRepository.getStore(
       at …






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.