Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8848927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:31:09+00:00 2026-06-14T12:31:09+00:00

I am making a function that compares two pictures if they are the same.

  • 0

I am making a function that compares two pictures if they are the same. I have this code:

var rez = null;

rez = compareImages();

alert(rez);


boolean
function compareImages() {
  BufferedImage bi1 = java.ImageIO.read(new File("C:\\MyFiles\\pic1.png")),
    bi2 = java.ImageIO.read(new File("C:\\MyFiles\\pic2.png"));
  Raster r1 = bi1.getData(),
    r2 = bi2.getData();
  DataBuffer db1 = r1.getDataBuffer(),
    db2 = r2.getDataBuffer();
  int size1 = db1.getSize(),
    size2 = db2.getSize();

  // checking if the files sizes are the same
  if (size1 != size2)
    return false;

  // pixel by pixel check up
  for (int i = 0; i < size1; i++)
    if (db1.getElem(i) != db2.getElem(i))
      return false;

  return true;
}

Now I want to run this code in .js file but when I do I get an error, missing ";" error. So how do I make this function javascript compatible ?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T12:31:10+00:00Added an answer on June 14, 2026 at 12:31 pm

    You can’t run Java code in JavaScript. You can either compile your Java code as an applet and embed that in you page, or you just rewrite your code in JS. If you use the html5 canvas and the getImageData() function, this should be doable. That way you can easily interact with your code from JavaScript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im making a program for class that manages a Hotel. I have a function
I am making ajax call like this $(document).ready(function() { var abc = new Array();
When making a function call in Linux (or OS X for that matter), can
I use JEditable for making edit field which following code: $(function() { $(.field).editable(http://localhost/index.php/welcome/update_record, {
I have two tables with same schema , and primary key as noc for
I'm making a function that multiplies all numbers between an 1 input and a
I'm making a function that takes a table name and a key value array
Hey so i'm making a function that gathers up sprites that you wanna keep
How would I go about making an function that does date and time like
I'm new to programing and was given a task of making a function that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.