Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

Java

99K

Solutions

32K

Contributors

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

My Spiring  RestService delete method has signature :

public ResponseEntity<?> delete(@RequestBody List<Long> IdList)


Question :
I am making a client code and trying to send  list of  long id's to  my above service  with the help of  RestTemplate  delete .  But it seems RestTemplate delete method does not accept list of long ids . How to fix this ?

Here is the wrong code:

RestTemplate.delete("/bsi/extgd/v1" + [2,3,4]);

Is there any way to fix this ?
0
Free Tool: Port Scanner
LVL 11
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

i just need to pass an array to rpg from java but its not running error free.
here is my code

import com.ibm.as400.access.*;
import java.beans.PropertyVetoException;
import java.io.IOException;

public class CallingArrayPgm {
    public static void main(String[] args) throws PropertyVetoException{
      try{
                  
            AS400 sys=new AS400("192.168.111.211", "THARINDU", "GAYAN@123");            
            
                  int[] accounts = new int[5];
             
             AS400Array accountsarray = new AS400Array();
               
               
            ProgramParameter[] parmList1 = new ProgramParameter[1];
                ProgramParameter[] parmList2 = new ProgramParameter[1];
               
                parmList2[0] = new ProgramParameter(accountsarray.toBytes(accounts),5);  
               
             ProgramCall pgm = new ProgramCall(sys,"/QSYS.LIB/THALIB.LIB/ARRAYTEST.PGM",parmList2);
             
                 if (pgm.run()!=true) {
                System.out.println("executed");
            }else{
                   
                    AS400Text text = new AS400Text(30);
                     sys.disconnectService(AS400.COMMAND);
                   
            }
               
                AS400Message[] messageList = pgm.getMessageList();
                System.out.println(messageList.length + "TEst ok");
        
              sys.disconnectService(AS400.COMMAND);
              
            }catch(AS400SecurityException | ErrorCompletingRequestException | ObjectDoesNotExistException | IOException | InterruptedException e) {
                  System.out.println(e.toString());
      …
0
Hi,

We are using Java Webstart for one of the requirements(downloading files) in the applicaton which are developed by 3rd party vendors earlier.Now when we access the application we are getting certificate is expired.

I think all jars must be signed to launch JNLP application.Please confirm.

I have tried to remove files (*.SF, *.RSA) files in MANIFEST-MF But when we access the application getting 'unsigned resource access to http-mime-4.2.2.5.jar';
I think we can't launch JNLP Webstart application without signed jars.Please confirm.

https://kbdeveloper.qoppa.com/removing-a-signature-from-a-signed-jar-file/

 Followed the steps below to remove a signature from a jar file
******************************************************************
Open the jar using WinRar or Winzip (jars are actually zip files)
Go into the META-INF directory
Delete all files (*.SF, *.RSA) but keep MANIFEST-MF.



Executed jarsigner command on each jar  which are used and all are expired last year(10th Oct'17) itself and as you see all jars are signed with certificate.

I have few clarifcations.

1)What certificates does digicert give after taking renewal from them?
2)How to sign all the jars again?Please provide the command?

jarsigner -verify -certs -verbose download-manager.jar

s       9619 Mon Nov 10 15:55:56 EST 2014 META-INF/MANIFEST.MF

      X.509, CN="XXXXXXXX.", O="XXXXXXXX.", L=DDDDD, S
T=Calif, C=US
      [certificate expired on 10/10/17 8:00 AM]
      …
0
Hi

I finished our colossal collaboration of a network game with a central server, a while ago. I will convert it to python now that I'm shifting to it as well. Is that unadvisable - python might not be optimal for a game server?

I know the Massachusetts Institute of technology had an RTS AI coding contest, before.
There's also ORTS, open rts
There seem to be many similar links on Google.
The MIT contest was geared to a confusing, un-watchable mess of a game, in my opinion.

Do these types of contests have any traction? now? Any of them non-college?
I have many ideas, some non 3D war. Do the current AI game-systems have a server that distributes all the activity packages to each client for every frame (hackable) Mine is all server centralized.
Thanks
0
I have the following code that should be in charge of managing singletons of various classes:

class SetSingleton {
    private final static HashMap<String, Serializable> singletons = new HashMap<>();

    public static <T> HashSet<T> getTypedSet() {
        String typeName = /* this is where I need your help */;
        Serializable result = singletons.get(typeName);
        if (result == null) {
            result = new java.util.HashSet<T>();
            singletons.put(typeName, result);
        }
        return (HashSet<T>) result;
    }
}

Open in new window

I would like to use it as follows:

        HashSet<String> stringSetSingleton = SetSingleton.getTypedSet();
        HashSet<Long> longSetSingleton = SetSingleton.getTypedSet();

Open in new window

What do I have to write instead of /* this is where I need your help */ in order to get the current instance of T (e.g. String, Long and so on)? All I need is the instance type's name, if that helps.

Thanks.
0
I am getting a exception when trying to deploy it on 12.2.1,


<WebLogicServer> <BEA-000360> <The server started in RUNNING mode.>
     [java] WLST-WLS-1516225291084: <Jan 17, 2018, 3:41:43,107 PM CST> <Notice>  <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>
     [java] Server started successfully.
     [java] Connecting to t3://127.0.0.1:7001 with userid wlsboot ...
     [java] WLST-WLS-1516225291084: <Jan 17, 2018, 3:41:45,493 PM CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=admin7001 : Initializing callbacks>
     [java] WLST-WLS-1516225291084: <Jan 17, 2018, 3:41:45,493 PM CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=admin7001 : Added MBeanServerConnection in DomainRuntimeServiceMBean >
     [java] WLST-WLS-1516225291084: <Jan 17, 2018, 3:41:45,509 PM CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=admin7001 : Callback is done>
     [java] WLST-WLS-1516225291084: <Jan 17, 2018, 3:41:45,509 PM CST> <Warning> <JMX> <BEA-149535> <JMX Resiliency Activity Server=admin7001 : Connection already exists for the server. Did not attempt to connect to the server>
     [java] Successfully connected to Admin Server "admin7001" that belongs to domain "erm7001".
     [java]
     [java] Warning: An insecure protocol was used to connect to the server.
     [java] To ensure on-the-wire security, the SSL port or Admin port should be used instead.
     [java]
     [java] Location changed to edit …
0
I am setting up an Equallogic PS6500, older firmware, version unsure right now. and when i browse to IP i get "Your browser does not seem to have Java support enabled, or it does not have a Java plug-in.

You can download the latest Java plug-in by clicking here."

I have newer firmware equallogics v9 and dont have this problem.  I am trying to hunt down how i can upgrade firmware over db9 or if this is an Java issue.

Help is appreciated.
0
String ( 2 loop based problem)

Given a string, look for a mirror image (backwards) string at both the beginning and end of the given string. In other words, zero or more characters at the very begining of the given string, and at the very end of the string in reverse order (possibly overlapping). For example, the string "abXYZba" has the mirror end "ab".

mirrorEnds("abXYZba") → "ab"
mirrorEnds("abca") → "a"
mirrorEnds("aba") → "aba"
0
For example ,If the zip file[1234567890123_p01.zip] is greater than 1 GB, then the zip file needs to split  into multiple ZIP files. Each of these ZIP files would need to be under 1 GB, and would append an underscore and order digits to the end of the file name formula. For example, if the zip has 2.4 GB , their final output might look like this:

1234567890123_p01_01.zip (900 MB)
1234567890123_p01_02.zip (800 MB)
1234567890123_p01_03.zip (700 MB)
0
Hi All,

My requirement is as follows:

User uploads a file from a web application ( AngularJS )
System need to process the file asynchronously

Note : There could be hundreds of files getting uploaded.

Each files will be processed in different containers with same algorithm

1. Now Do I need a MQ here ?
2. If so Rabbit or Kafka or Tsung
3. Can anybody please help on the same ?

This application will have 1. File Processing 2. Billing 3. Analytic Data and Reports based on that

1. Which will be the right DB for the same ?

Regards
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I want to  filter my datatable then select row, i do this but the select return null after filter ?!

my xhtml page:
<h:form>
      <p:dataTable id="dt" var="s" value="#{searchBean.tvList}" emptyMessage="No Object found with this id" rowKey="#{s.tag}" >
            <f:facet name="header">SELECT FROM DATABASE</f:facet>
            <p:column headerText="TAG" filterBy="#{s.tag}" filterMatchMode="contains" style="text-align: center">
                  <h:outputText value="#{s.tag}" />
            </p:column>
            <p:column headerText="TEXT" filterBy="#{s.text}" filterMatchMode="contains" style="text-align: center">
                  <h:outputText value="#{s.text}" />
            </p:column>
            <p:column style="text-align: center">
             <h:commandButton value="SELECT" action="#{searchBean.printResult()}">
                <f:setPropertyActionListener value="#{s}" target="#{searchBean.selectedTV}" />
            </h:commandButton>
            </p:column>
      </p:dataTable>
</h:form>

and my managebean:-

@ManagedBean
emphasized text@ViewScoped
public class SearchBean {
      private TV selectedTV;
      private List<TV> tvList;
      
      public TV getSelectedTV() {
            return selectedTV;
      }

      public void setSelectedTV(TV selectedTV) {
            this.selectedTV = selectedTV;
      }
      
      public List<TV> getTvList() {
            return tvList;
      }
      
      @PostConstruct
      public void loadData() {
            tvList = new ArrayList<TV>();
            Operations dao_pojo = new Operations();
            tvList = dao_pojo.get_all_data_TV();
            
      }

      public void printResult() {
            if(selectedTV == null) …
0
Hi,

I have a requirement to make a manual work to automation. Here is the complete details about the automation plan.

1. Need to prepare a Java script by combining the SQL db as back end. These JavaScript can be scheduled in a 15 minutes once.
Once this Job got scheduled, it will run the java script and get the details from the SQL database(Select script which is ready with me!)
2. My condition in the java code should if the customer Which we are passing having any values in that time frame, it should pick and prepare a spreadsheet if there is no transactions it can be ignored for that run.
3. Also another requirement is to pull the logs from the servers based on the customer ID passed in the code. If there is a way to do that. We can implement the same.

Please share your thoughts and suggestions if any.

Thanks
Venkatesh.
0
I've been thinking to migrate my erp(java currently) from rdbms(firebird currently) to nosql (mongoDB likely) and i trying to antecipate some issues. I'm trying to make a "failproof" inventory control which never let a qty's item be smaller than 0. Offcourse i still get "ACID bias" which i need to left in order to complete this task. The goal is update inventory qty of all order's items when approve the order. For that, 2 problems can occur which currently are resolved with a trigger.

1.problem: order gets 2 items (ball = qty 2 and chair = qty 1) and there is no enough qty in inventory (ball = qty 1 and chair = qty 0) to complete the order. Once i trigger the command do complete the order, a loop is executed to decrease qty in inventory and fails on the second item cause there is no enough qty. Consequently rollback operation is trigged and everybody go home happy.

2.problem: in one word, concurrency. suppose there is no trigger controling this operation but only "selects and if". User 1 query inventory qtys, see enough qty (ball = 2, chair = 1) e system allow complete the order. While the transaction is running user 2 query same invetory qtys but because first transaction is not complete yet second query see "old" qty (ball = 2, chair = 1) e system also lets complete order. Consequently, 1 qty of chair is descreased twice, but shold be descreased only once and fail on the second. Result: i got negative qty.

I saw some workarrounds with inventory reservation but i …
0
Hi, so I've got an Ionic 3 app which has a native camera plugin and onesignal plugin as well for notifications.

The native camera plugin works fine in Ionic View or DevApp, and onesignal works when build it to an APK and run it natively on my Android phone.

However, when I use an emulator to run it, even on IOS, it comes up with cordova_not_available. And even the cameras don't work. i run the command

ionic cordova run android or ionic cordova run ios

Emulator shows up but the issue is that cordova doesn't seem to be compiled in. Thus causing cordova plugins to fail.

What can possible be the issue? I've removed all the plugins and android/ios platform, re-installed an still the same.

It's kind of difficult to develop the OneSignal notification when I can't run it with the emulator.

Anyone who has come across this, please advice.
0
HSSFSheet sheet = wb.getSheetAt(0);
            HSSFRow row;
            for(int i=1; i<=sheet.getLastRowNum(); i++){
                row =  sheet.getRow(i);
                int id = (int) row.getCell(0).getNumericCellValue();
                String name = row.getCell(1).getStringCellValue();
                String address = row.getCell(2).getStringCellValue();
                String sql = "INSERT INTO test VALUES('"+id+"','"+name+"','"+address+"')";
                pstm = (PreparedStatement) con.prepareStatement(sql);
                pstm.execute();
                System.out.println("Import rows "+i);
            }
i got error in declarating id, name and address
0
I have an application which has a token set to officially expire after 30 minutes. If inactive at the 20- minute mark, it looks back 5 minutes for activity. If none exists, it kills the session. The majority of the users do work in the first 10 minutes and usually tend to other tasks. They are frustrated with our settings and are asking us to check back farther than 5 minutes and the 20-minute mark.

What makes sense to do here in accordance with best practice?
0
When I enter the name of the person..
it has to display the person's date of birth...

The program has to have search button and textfield to enter the person's name.
one search button.
and calendar.

when i enter the person's name ..
after i click the search button ..
the calender has to show the date of birth of that person

It has to be in j2me midlet program using eclipse IDE
0
hi,

what is difference between control shift L and call hierarchy(control+alt+H)  in eclipse debugging the code.
what are best debugging techniques or tips

please advise
0
I seem to be having some brain cramps today. What I thought would be a very simple task is driving me crazy. I have a folder with about 30 text files and each file has anywhere from 100 to 2000 lines. Additionally, each file has an ending section with a variable number of lines. What I'm trying to do is copy each file back to its original name eliminating all of the lines of the ending section, of which the beginning can be determined by a key word. If, for (a simple) example, a file named TEST1.txt is in the folder and contained the following:
This is line1
This is line2

This is line3
This is the beginning of the end (contains the String "Auxilliary")
This is the first auxiliary line
This is the second auxiliary line
This is the last auxiliary line.

I want a new file named TEST1.txt that looks like this -
This is line1
This is line2

This is line3
- by not writing anything after finding the line containing the word "Auxilliary"

This would be repeated for each file in the folder.
As always, your help is greatly appreciated.
0
Receive 1:1 tech help
LVL 11
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

I have code in JAVA can you convert it in C# I want to create RSA SHA256 signature with private key here I have some reference code in java that I am sharing below. I have successful creating RSA sha256 signature using RSACryptoServiceProvider

String version = "2";

if (request.getMethod().equals("GET")) {
 String headerVal = "application/vnd.mobi.lcs.rmw+json; version=" + version;
 request.addHeader("Accept", headerVal);
} else if (request.getMethod().equals("POST")) {
 String headerVal = "application/vnd.mobi.lcs.rmw+json; version=" + version;
 request.addHeader("Content-Type", headerVal);
} else if (request.getMethod().equals("PATCH")) {
 String headerVal = "application/vnd.mobi.lcs.rmw.patch+json; version=" + version;
 request.addHeader("Content-Type", headerVal);
}

String authHeader = generateAuthorizationHeader(request, version);
request.addHeader("Authorization", authHeader);



private String generateAuthorizationHeader(HttpRequestBase request, String version) throws IOException, SignatureException) {
 String token = generateToken(); // Current timestamp and some random numbers

 try {
  this.sig = Signature.getInstance("SHA256withECDSA");
  sig.initSign(this.key);
 } catch (NoSuchAlgorithmException e) {
  throw new Error("No support for SHA256withECDSA! Check your Java installation.");
 } catch (InvalidKeyException e) {
  throw new Error("Invalid EC key!");
 }

 byte[] message = messageTop(request, version, token);
 sig.update(message);

 InputStream 

Open in new window

0
I have two excel files which i read in eclipse with the help of apache poi. I want to compare between the two excel files and perform operations:

my first excel file is accessed by HSSFReadWrite.java
my second excel file is accessed by XSSFReadWrite.java

then I want to compare the column 1 of file 2 with column 5 of file 1. if the entries match then I want the row to stay and paste columns 7,8,9,10,11 of file 2 into file 1 columns 15,16,17,18,19  or if the entries doesnt match then I want the rows to delete from file 1. the final output should be the modified file 1

i already have vba macros for the same that runs well. But I have to do it in Java.
reading-BOM-using-Apache-poi.txt
reading-BOM-using-Apache-poi.txt
VBAcode1.txt
VBAcode2.txt
0
Amit
0
i have Installed Jenkins In my system & i am Configuring with Java Later i set these below for Email notifications
 I have added the ssl enable to ture in Jenkins.xml Like below
-Djava.awt.headless=true -Dmail.smtp.starttls.enable=true

My SMTP settings are
SERVER smtp-mail.outlook.com
SMTP PORT 587
Use SSL unchecked
Username *****
Password ******


i got this error com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. n7sm1171686pgv.26 - gsmtp


      at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2057)

      at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1580)

      at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1097)

If Use SSL is checked i got this Error

javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

      at sun.security.ssl.InputRecord.handleUnknownRecord(Unknown Source)

      at sun.security.ssl.InputRecord.read(Unknown Source)

      at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)

Please go through this give me a solution as early as possible

Thanks In advance
0
An item in the list is either a dog or a cat .For each pet, enter it's name and type ('c' for Cat and 'd' for dog) Terminate the  input when the string Stop is entered for the name .
0
HI,

I'm having an issue identified with the ojdbc pool association and I have to investigate the ojdbc driver keeping in mind the end goal to get more data about the blunder. Does anybody know whether it's conceivable to connect the source code of the driver utilizing Java Attach Source module? I've attempted yet the module appears to never wrap up the source...

Thanks
 Luveshan
0

Java

99K

Solutions

32K

Contributors

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.