Java

99K

Solutions

33K

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

Hello experts,
 I have created a browser in visual c#, the simplest following the examples over the internet.
but I keep getting this message: " An error has occurred in the script of this page...
object does not support property or method 'aDDEventListener' "

but on main browsers like IE and chrome, this error message does not appear.

NOw I have already tried the following three methods to no effect:

Method 1:
1.      Click Start, and then click Run.
2.      In the Open box, type Regsvr32 urlmon.dll, and then click OK.
3.      When prompted with the DllRegisterServer in the urlmon.dll succeeded message, click OK.

Method 2:
1.      Open the Java Virtual Machine. To do so, visit the following Java Website: http://www.java.com/en
Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
2.      Close all instances of Internet Explorer.
3.      Click Start, click Control Panel, and then double-click Internet Options.
4.      Click the Advanced tab.
5.      Under Browsing, click to clear the Enable third-party browser extensions (requires a restart) check box.
6.      Restart Internet Explorer.

Method 3:
1.      Open Internet Explorer.
2.      Click Tools, and click Internet Options.
3.      Click the Advanced tab.
4.      Under Browsing, click to select the Disable Script Debugging checkbox.
5.      Click OK to close all windows, and then restart …
0
Free Tool: Path Explorer
LVL 12
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

I am trying to get started with a java application
I have already installed java, apache & maven but on the following import commands

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.boot.builder.SpringApplicationBuilder;

I get package or.springframework.boot does not exist. I believe it ts part of Maven
Any ideas anyone?
0
I have an activity where the user can update some data related to his profile (for example, his name) and he can also upload a new profile image.

After the update operation, the user is redirected to a new activity. The problem is that when the user comes back to his profile activity, the showed image is still the old one and not the new one while the name updated correctly.

In order to see the new profile image, the user needs to close the app and open is again.

How can I solve this problem? I use a function updateInfo(), but it seems to not work as I would like.

Can you help me, please?

public class ProfileActivity extends BaseActivity implements ProfileView {

    @BindView(R.id.avatar)
    ImageView p_avatar;
    @BindView(R.id.ib_back)
    ImageButton ibBack;
    @BindView(R.id.txt_title)
    TextView txtTitle;
    @BindView(R.id.ib_right)
    ImageButton ibRight;
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.et_fullname)
    EditText etFullname;
    @BindView(R.id.et_email)
    EditText etEmail;
    @BindView(R.id.btn_update)
    Button btnUpdate;
    @BindView(R.id.txt_logout)
    TextView txtLogout;
    @BindView(R.id.ll_main)
    LinearLayout llMain;

    private static final String TAG = "ProfileActivity";
    private String userName = null, userEmail = null;
    private ProfilePresenter profilePresenter;
    private Dialog dialog;
    Bitmap FixBitmap;
    Bitmap bitmap_to_save;
    ImageView ShowSelectedImage;
    

Open in new window

0
Can anyone suggest the least ‘intrusive’ way of adding a text label to a JSlider ? Thanks for any pointers.
0

I have a xml  like <url href="www.google.com">www.google1.com</url>
i am using dom parser to cheak both url should match or not (www.google.com and www.google1.com)
so i am Writing The code is :
String s=""; Document doc = dBuilder.parse(inputFile); NodeList nodeList= doc.getElementsByTagName("url"); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if(node.getNodeName().equals("url")){//Reconfirm after that getting content Element element = (Element) node; s=element.getTextContent(); String s2=element.getAttribute("href"). }So can u help me how to get href content so that i can cheak both value










0
Java script syntax error 4 on line var sf = this.addField(name, type, page, mySigRect);


var name = "sigField";
var type = "signature";
var page = 0;
var mySigRect = ;
var sf = this.addField(name, type, page, mySigRect);
0
Hello Experts,

We are tasked to migrate a Mainframe application to Java. I would like to see these COBOL programs. Is there a way to skim through these MF files like we do in other languages.

 I cannot access the MF terminal (do not know how to :() . I am using a windows PC and do have windows server at the client's location.

Thanks in Advance.
0
I'm upgrading from MySQL 5.1 to MySQL 8.0.  I have a java project that uses Toplink to connect to the database.  I've updated the jdbc drivers but when I try to connect I get this error "Public Key Retreival is not allowed".  I've set UseSSL to false but I still can't connect.  I'm assuming there must be some new parameters that I also need to set up , but I don't know what they are or where to look for them.
0
I'm using a Java Window and adding() a JLabel to it - the only component.

A Window's default Layout is BorderLayout, and I have placed the JLabel at BorderLayout.CENTER.

However, the JLabel text seems to be left-aligned, right on the left edge of the Window. I want it in the centre, so what would I need to do?

Thanks k.
0
Hello

I am trying to print out the values of my array of objects. Been at it a couple of hours and I've decided to ask for help

public class DataBase1 {

    int id;
    String firstName;
    String lastName;
    String skill;
    Boolean bool;

    DataBase1(int id2, String name1, String name2, String skill2, boolean b){ //constructor
        int id = id2;
        firstName = name1;
        lastName = name2;
        skill = skill2;
        bool = b;
    }
    public String toString(int id, String firstName, String lastName, String skill, boolean b){
        return toString();
    }
}
----------------------------------------------------------------------------------------------------------------------
public class Server {

    public static void main(String[] args) {

        int size = 5;
        DataBase1 staff[] = new DataBase1[size];
        staff[0] = new DataBase1(1, "John", "Doe", "Java", true);
        staff[1] = new DataBase1(2, "John", "Doe", "Java", true);
        staff[2] = new DataBase1(3, "John", "Doe", "Java", true);
        staff[3] = new DataBase1(4, "John", "Doe", "Java", true);
        staff[4] = new DataBase1(5, "John", "Doe", "Java", true);

        for(int i = 0; i < staff.length; i++){
            System.out.println(staff[i]);
        }

        System.out.println(Arrays.toString(staff));
}
}
0
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

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.

Dear Experts:

I got several buttons that activate/run a java script on my adobe Acrobat form , called MyButton1, MyButton2, MyButton3, MyButton4

Is it possible to have a master button that activates all these buttons in one go, one after the other.

Help is much appreciated.

Thank you very much in advance.

Regards, Andreas
0
I'm getting the following error:
<soap:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope">
      <faultcode>env:Sender</faultcode>
      <faultstring>Invalid version of SOAP in the request. SOAP 1.2 must be used. </faultstring>
    </soap:Fault>

Open in new window


How do I pro grammatically or using a config file change the SOAP to 1.2?

I have tried putting this line on the interface file but does not seem to be working. @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)

I'm currently call the service like this:
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
            loggingInInterceptor.setPrettyLogging(true);
            LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
loggingOutInterceptor.setPrettyLogging(true);

CORETransactionService service = new CORETransactionService();
CORETransaction port = service.getCoreSoapPort();

Client client = ClientProxy.getClient(port);
Endpoint endpoint = client.getEndpoint();

endpoint.getInInterceptors().add(loggingInInterceptor);
endpoint.getOutInterceptors().add(loggingOutInterceptor);

Map<String, Object> ctx = ((javax.xml.ws.BindingProvider)port).getRequestContext();

Open in new window

0
I'm trying to set the SOAP Request to 1.2.  So with some research I see that you can accomplish this using the following code.

Service service = Service.create(servName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, ServerMisc.DOCLIT_CODEFIRST_URL)

Open in new window


Where do I get portName from?
0
import java.sql.*;

class JdbcInsert1
 {
   
 
   public static void main (String[] args)
 {
     
   try
 {
       
    Class.forName("oracle.jdbc.driver.OracleDriver");
     String url = "jdbc:oracle:thin:@elcot-pc:1521:system";
     
       Connection conn = DriverManager.getConnection(url,"system","tiger");
 
          Statement st = conn.createStatement();
   
         st.executeUpdate("INSERT INTO customer " +
 "VALUES (1001, 'Simpson','mtp')");
 
          st.executeUpdate("INSERT INTO customer " +
"VALUES (1002, 'McBeal','mtp')");

            st.executeUpdate("INSERT INTO customer " +
"VALUES (1003, 'Flinstone','mtp')");
     
      st.executeUpdate("INSERT INTO customer " +
"VALUES (1004, 'Cramden', 'mtp')");

 
          conn.close();
 
       }
 catch (Exception e)
{
         
   System.err.println("Got an exception! ");
 
          System.err.println(e.getMessage());

        }

    }


}

JdbcInsert.java:15: error: unreported exception ClassNotFoundException; must be
caught or declared to be thrown
            Class.forName("oracle.jdbc.driver.OracleDriver");
                         ^
1 error
plz anyone tell me solution for this problem
0
Experts, I have started working on Selenium and would need your help in finding XPATH of webpage elements in browsers. If there is any tutorial using which I can help find the right xpath to elements using developer tools, it will greatly help. Thanks.

Just to add, I have used the chrome Inspect Element -> XPath option, but would like to know if there are other non-browser tools or plugins which are more friendlier and descriptive.
0
Hello, I have a coding problem where I am asked to create a robot and move it using the java.awt.point class and methods. I have coded what i thought is the
correct answer but for some reason the move method doesn't move the robot one space from the origin until you call it twice. Please help! The out put to the code is x = 0, y = 0 when y should be 1. Very lost as to why it moves one space on the second call and not the first one!






public class RobotDirections
{
    public static void main(String[] arg){
        Robot Craig = new Robot(1) ;
        
        Craig.move() ;
        
        System.out.println(Craig.getLocation()) ;
       
    }
}

Open in new window


import java.awt.Point ;
public class Robot
{
    private int directionFacing ;
    private Point robot = new Point() ;
    //North East South West
    private String N_E_S_W_ ;
    private int X = 0 ;
    private int Y = 0 ;
    
    public Robot(int directionFacing){
        this.directionFacing = directionFacing ;
        this.robot = new Point(X,Y) ;
    }
    
    public void turnLeft(){
        if(directionFacing == 1 ){
            directionFacing = 5 ;
        }
        else if(directionFacing == 2 ){
            directionFacing = 2 ;
        }
        else if(directionFacing == 3 ){
            directionFacing = 3 ;
        }
        else if(directionFacing == 4 ){
            directionFacing = 4 ;
        }
        directionFacing-- ; 
    }
    
    public void turnRight(){
        

Open in new window

0
I have a new Samsung Galaxy S9 which replaces a Samsung Galaxy S6 and I have two issues which are probably connected:

a) I cannot use the App "Wifi File Transfer Pro" - when I launch the App on the phone it gives an IP address to enter into my browser on the PC, but when I enter this address it will not bring up the page - the connection eventually times out; on the Galaxy S6 this works perfectly

b) I have an app I have written in Java which has components running on the phone and my PC, which I use for transferring various files between the phone and my PC - again this has worked perfectly for many years on the Galaxy S6, but on the S9 it fails to connect:  the phone component successfully wakes up the PC component which does its thing and then tries to connect to send the result, but the java command connection=new Socket(host, PORT) times out with the error message "java.net.ConnectionException: Connection timed out: connect"

It looks like a firewall issue, but it's not the firewall on my PC since I've tried disabling that temporarily.   It may be a firewall issue on the Samsung S9 but I can't see how to configure that.   I've tried tweaking the Setting "Phone visibility" but that doesn't seem to solve the issue.

Any thoughts?
0
Created a keystore file using Java and Configured Tomcat to use the keystore But Tomcat Server failed to start

While running the Java application it shows
"Server Tomcat v7.0 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor."

Open in new window

.



s.jpg
0
Hi, Trying to build a java project in Eclipse Neon and I'm getting the error below. When I look at the Java compiler settings for the project it shows as using 1.8 so I'm not sure where it is getting the 1.7 from. My java version is 1.8.0.51. Is there another eclipse settings somewhere which might still be referring to 1.7

lambda expressions are not supported in -source 1.7
  (use -source 8 or higher to enable lambda expressions)

Thanks
0
Cloud Class® Course: CompTIA Cloud+
LVL 12
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

sir i have a list :that contain some value : after i am geeting node content value: and cheak that node content value contains list value or not:but i am getting exception because list not converted to charsequence : my code is List<String> xx = new ArrayList<String>(); xx.add("Van"); xx.add("Von"); xx.add("Le"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document d = builder.parse(file); d.getDocumentElement().normalize(); String[] s = xx.toArray(new String[xx.size()]); NodeList ndlist = d.getElementsByTagName("personName"); for (int i = 0; i < ndlist.getLength(); i++) { Node node = ndlist.item(i); NodeList nl = node.getChildNodes(); for (int j = 0; j < nl.getLength(); j++) { Node node1 = nl.item(j); if (node1.getNodeName().equals("givenNames")) { Element element = (Element) node1; String str = element.getTextContent().toUpperCase(); if(str.contains(xx))//error list cannot convert to charsequence { //some opration } } }
0
I have a java web service that is supposed to start automatically when it is deployed.  For some unknown reason it does not.  I am seeking guidance on how to figure out why it is not starting automatically.  I am using jdk 1.8, jax ws 2.2.6, tomcat 8 on rhel 7.  Here is what I have in the web.xml file for the service servlet:
    <listener>
        <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>MiscService</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>MiscService</servlet-name>
        <url-pattern>/MiscService</url-pattern>
    </servlet-mapping>

Open in new window


Is there something else I am supposed to do other than put the number 1 in the load on startup tag?  Everything that I have googled said that this is all I need to do.  My server admin guy is not much help and if there is something on the server side that needs to be done can anybody please tell me that.  If there is something else that I need to put in my code then please let me know.

I do not have this issue in the development or staging environments but I can say that the one difference in the production environment, which is where I am having this issue, is that the web service is served via a load balancer.  The request goes through one of two regular apache web server to tomcat.

HELP!!!
0
hi i am kumar:i have a issue in my java application:actually i wants to read xml file using dom parser:in xml file lots of Numeric Character Entities like(&#x000A9;&#x000EA;) are parsent in diffrent place;i have a requirment to find that Numeric Character Entities with pattern :  whenever we fing we simply skip that node content element:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
         Document d = builder.parse(file);
        d.getDocumentElement().normalize();
NodeList  ndlist1= d.getElementsByTagName("title");
for (int i = 0; i < ndlist1.getLength(); i++) {
            Node node = ndlist1.item(i);
            String attValue = "";
           attValue = node.getTextContent();
            System.out.println("val=" + attValue);

Open in new window

:
when i print cpntent of node they can print some special charcter:so my pattern doesnot  find:so kindly help me to figure out this problem
0
I have this program I’ve been asked to manage. It’s a Java + Apache Camel program which is running via a windows service. The program sends and receives XML messages and saves them to SQL server. For the most part I have some Java experience but I’m still new and I don’t know too much about camel (other then that it looks to be the Interface between the Java core and any sort of network traffic)

It currently runs fine on its own deployed on a specific machine, but I want to run it on a different windows machine to play around with. So I copied over the entire root folder that contains all the jar files/configuration files etc, edited the configuration (so all pathnames are correct for the new location, and points to a different SQL database), and I created the new windows service (using prunsrv and prunmgr) and edited the service to have similar parameters to the existing windows service.

It all looks like I am 99% done, but when I run the service, the program generates some error, where there was an error creating a bean for some class and at the bottom mentioning a Java lang class not found exception for org.apache.camel.component.sql.swlcomponent

I don’t quite see what the issue is if I copied everything over. I went one step ahead and copied over all the Java and apache maven folders from the original machine to the new one and set up the environment variables to pick up from these folders instead but the issue still remains

If I build a jar file from the original …
0
I have a text field and want to implement regular expression to validate mm/dd format. I have a regex currently which works for this format but not able to validate against months like 29th February, 30th April etc.. How to modify the regex to include this month validation?

Currently regex I'm using is - (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])
0
Want to develop a simple tool which installs into windows (xp,7,8,10) and run in background on startup.
It just detect if internal or external USB webcamera is present or not (simple write a log file if camera doesn't exist).

Now my question is which language and IDE is suitable for it ?
JAVA or C# ?
0

Java

99K

Solutions

33K

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.