Closed willishf closed 6 years ago
Converted the image to PNG and was able to load. Suspect the problem is JPG is dependent on JNI.
Was getting ready to start up a project where lots of experience with GWT from 10 years ago. It appears it hasn't advanced much since last using.
Really excited about the potential and looks like you have save the JAVA SE API or at least made it relevant as a web framework. If RMI works really going to add some interesting options for application deployment.
THANK YOU THANK YOU FOR CHEERPJ.
Can you share this sample program with us? It would simplify testing and fixing the issue on our side.
I will put together a test case with sample image.
On Fri, Jun 22, 2018 at 6:52 AM Alessandro Pignotti < notifications@github.com> wrote:
Can you share this sample program with us? It would simplify testing and fixing the issue on our side.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leaningtech/cheerpj-meta/issues/33#issuecomment-399403901, or mute the thread https://github.com/notifications/unsubscribe-auth/AD3dnvv0kUnyf7qOQpQ71tuAUZUYJOiIks5t_Mx_gaJpZM4UyMiT .
/*
/*
public class ImageCanvas extends JPanel implements MouseListener {
public static BufferedImage image;
public ImageCanvas(){
super();
this.addMouseListener(this);
}
public ImageCanvas(String fileName) {
super();
this.addMouseListener(this);
setFileName(fileName);
}
public void paintComponent(Graphics g) {
g.drawImage(image, 0, 0, null);
repaint();
}
@Override
public void paint(Graphics g) {
super.paint(g); //To change body of generated methods, choose Tools | Templates.
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.RED);
g2.setStroke(new BasicStroke(4));
for (Point p : points) {
g2.drawOval(p.x, p.y, 4, 4);
}
}
public static void main(String[] args) {
JFrame f = new JFrame("Window");
String fileName = "C:/Users/Scooter Willis/Documents/NetBeansProjects/AnnotateROI/images/image1.jpg";
f.add(new ImageCanvas(fileName));
f.setSize(image.getWidth(), image.getHeight() + 30);
f.setVisible(true);
}
ArrayList<Point> points = new ArrayList<Point>();
public void setFileName(String fileName){
try {
image = ImageIO.read(new File(fileName));
this.setSize(image.getWidth(), image.getHeight());
setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
} catch (Exception e) {
//Not handled.
e.printStackTrace();
}
}
public void setPoints(ArrayList<Point> p){
this.points = p;
}
@Override
public void mouseClicked(MouseEvent me) {
Point p = me.getPoint();
//System.out.println(me);
//System.out.println(p);
points.add(p);
//repaint();
}
@Override
public void mousePressed(MouseEvent me) {
System.out.println(me);
}
@Override
public void mouseReleased(MouseEvent me) {
System.out.println(me);
}
@Override
public void mouseEntered(MouseEvent me) {
System.out.println(me);
}
@Override
public void mouseExited(MouseEvent me) {
System.out.println(me);
}
}
Fixed with current "latest" endpoint (https://cjrtnc.leaningtech.com/latest/loader.js). Please remember to clear the browser cache to get the new code.
Doing a simple test program that loads a JPEG image and displays image. Java application works. Get the following error message in javascript console. I suspect it is an JNI problem and found one other post with similar issue. I placed the file in the /app/ directory and using that path to load the file.
Will try PNG and see if that finds a non-JNI path to loading image. Would be good to have a working example either using ImageIO or some other third party pure Java library.
loader.js:409 Uncaught ReferenceError: afp is not defined at aft (icu.js:1) at afz (icu.js:1) at a0E (icu.js:1) at cheerpjJNIBridge (loader.js:1901) at _c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirzm8kbGbzjKbf9GYEIJABIAIAIgbGWANgKTvhfmnrhzSAlqWcHxOeSorWDCivrbdqdDUiuJdp7nd (rt.jar.com.sun.imageio.plugins.jpeg.js:29) at _c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirz08kbWaruTDebWG4bloSN4PbzJepoM0khNcebWm7zq_fFdynLxeyhRVcinreb (rt.jar.com.sun.imageio.plugins.jpeg.js:63) at N3com3sun7imageio7plugins4jpeg15JPEGImageReader._c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirz48kbWareEebWGN4PbzJ0moMKigNcebW4zq_fFdynLxKvnI8gvrbreXqrlb [as v37] (rt.jar.com.sun.imageio.plugins.jpeg.js:63) at Object.eval [as func] (eval at buildContinuations (loader.js:135),:3:300)
at runContinuationStack (loader.js:395)
at cheerpjSchedule (loader.js:961)
aft @ icu.js:1
afz @ icu.js:1
a0E @ icu.js:1
cheerpjJNIBridge @ loader.js:1901
_c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirzm8kbGbzjKbf9GYEIJABIAIAIgbGWANgKTvhfmnrhzSAlqWcHxOeSorWDCivrbdqdDUiuJdp7nd @ rt.jar.com.sun.imageio.plugins.jpeg.js:29
_c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirz08kbWaruTDebWG4bloSN4PbzJepoM0khNcebWm7zq_fFdynLxeyhRVcinreb @ rt.jar.com.sun.imageio.plugins.jpeg.js:63
_c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirz48kbWareEebWGN4PbzJ0moMKigNcebW4zq_fFdynLxKvnI8gvrbreXqrlb @ rt.jar.com.sun.imageio.plugins.jpeg.js:63
(anonymous) @ VM3447:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
cheerpjFileLoaded @ loader.js:1047
load (async)
webReadAsync @ cheerpOS.js:298
cheerpjReadAsync @ cheerpOS.js:1379
_read @ icu.js:1
_readFully @ icu.js:1
_readFullyAt @ icu.js:1
_ZIP_GetEntryDataOffset @ icu.js:1
_ZIP_Read @ icu.js:1
_InflateFully @ icu.js:1
_ZIP_ReadEntry @ icu.js:1
ZN9ZipFileJS15getDataForEntryERKN6client6StringE @ icu.js:1
ZipFileJS.getDataForEntry @ icu.js:1
cheerpjClassLoadFile @ rt.jar.js:240
cheerpjResolveVirtualIndex @ loader.js:2477
Z17JNIEnvGetMethodIDPP18JNINativeInterfaceP16cheerpclientptrPKcS5 @ icu.js:1
_Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs @ icu.js:1
_c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirzW8kbWaru9nsdYKrlqSyNK3c9BCo3cGKKyqiS3l @ rt.jar.com.sun.imageio.plugins.jpeg.js:29
_c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrD$yQhOirzW8kbWaruCS3R3l @ rt.jar.com.sun.imageio.plugins.jpeg.js:63
N3com3sun7imageio7plugins4jpeg15JPEGImageReaderX @ rt.jar.com.sun.imageio.plugins.jpeg.js:32
cjG @ loader.js:2236
_c4pcQZ9ocdGbbIZ$ZcLbsJeEYdHrn_yQhOirza9kbWare7dInTqebW0rqKSyJ0eqJaHhd9JmAqcHWK3PbzJuwc08sib @ rt.jar.com.sun.imageio.plugins.jpeg.js:78
_c4Vbz_8ocdGbbIZT0dsnUirma9kbWare7dInTqebW0rqSSyJ0eqJaH3R3t7iqZlDd @ rt.jar.javax.imageio.js:13
_c4VbzV8ocdGbbIJ9UirimSiQFrhy9kbWarK4ereWKteEdX1K3R3tZiqZlTc @ rt.jar.javax.imageio.js:438
_c4VbzV8ocdGbbIJ9UirimSiQFrhy9kbWarK4ereWKteEdX1K3Rhd9BmAqcHWe @ rt.jar.javax.imageio.js:438
_c4VbzR8ocdGbbIZUirhGSikEebWG3tCiWlcaVakpmtTUrKuCZd1eBrriekfWFX3awt5fHuJiVrvuqermu0t @ rt.jar.javax.imageio.js:368
(anonymous) @ VM3440:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
xhr.onload @ cheerpOS.js:222
load (async)
webGetAsyncImpl @ cheerpOS.js:156
webLoadAsync @ cheerpOS.js:233
cheerpjOpenAsync @ cheerpOS.js:1348
_h4p32io16RandomAccessFile5open0Es0_WIEV @ rt.jar.java.io.js:467
_h4_22io16RandomAccessFile4openEs0_WIEV @ rt.jar.java.io.js:473
_h4p22io16RandomAccessFileC2Ej1rW4ebHe9lS3l @ rt.jar.java.io.js:473
_c4VbzB9ocdGbbIJU0uebaJn9hYcHirtySyZd1eBrviGab7zq_eBJ4Gteic79c @ rt.jar.javax.imageio.js:310
_c4pcQp9ocdGbbIZT0dI99hYcHirquTyZd1e7uebad7dIDUqebWetvieihlnb0iq4Xq_gJgKqimDG_eBJ4Gt0tcfIbzJuAc8srwbjuOb @ rt.jar.com.sun.imageio.js:200
_c4VbzR8ocdGbbIZUirhOSiQTTqebWeHroSCZd1e7uebaJhd9FmAqcHWK3tcjWlfLcKqTd @ rt.jar.javax.imageio.js:368
(anonymous) @ VM3438:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
xhr.onload @ cheerpOS.js:222
load (async)
webGetAsyncImpl @ cheerpOS.js:156
webStatAsync @ cheerpOS.js:246
cheerpjStatFileAsync @ cheerpOS.js:1300
_h4F42io14UnixFileSystem11checkAccessEjzsW4efYWIEZ @ rt.jar.js:191
_h4p12io4File7canReadEVEZ @ rt.jar.js:84
_c4VbzR8ocdGbbIZUirhGSikEebWGNb9JSnId$hYcXrou8nG1uErU0iYBufferedfvd @ rt.jar.javax.imageio.js:368
(anonymous) @ VM3364:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
cheerpjFileLoaded @ loader.js:1047
load (async)
webReadAsync @ cheerpOS.js:298
cheerpjReadAsync @ cheerpOS.js:1379
_read @ icu.js:1
_readFully @ icu.js:1
_readFullyAt @ icu.js:1
_ZIP_GetEntryDataOffset @ icu.js:1
_ZIP_Read @ icu.js:1
_InflateFully @ icu.js:1
_ZIP_ReadEntry @ icu.js:1
__ZN9ZipFileJS15getDataForEntryERKN6client6StringE @ icu.js:1
ZipFileJS.getDataForEntry @ icu.js:1
cheerpjClassLoadFile @ rt.jar.js:240
_m4_35Class19getDeclaredMethods0EZEAl0pcmfSUrFa @ rt.jar.js:240
_m4F55Class25privateGetDeclaredMethodsEZEAl0pcmfSUrEa @ rt.jar.js:282
_m4F25Class25privateGetMethodReaEXsiveEs0FWAr9dd$hzrsfSVrhvSwueagtdHatbRB0z @ rt.jar.js:282
_m4_05Class10getMethod0Es0FWArbtWZmvccmfSUrbb @ rt.jar.js:282
_m4F05Class9getMethodEs0FWAr5ctKGatbRB0p @ rt.jar.js:282
(anonymous) @ VM3366:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
classLoadComplete @ loader.js:188
error (async)
loadScript @ loader.js:313
cheerpjLoadJarPackage @ loader.js:336
_m4VanRn3cGKuPdWarunFbsZWMJZK0ueWtrzeSNe9ZKebNxKp @ rt.jar.js:297
_m4VanRn3cGKuPdWarKnEbsZWMJZK0ueWtrzCmA0j1YINe9ZKebNxer @ rt.jar.js:324
_m4VanJm3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:324
_m4VanJm3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:324
_c4pbMxWAxsDjavJWbrKV2Zd3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:1777
loadWeakClass @ loader.js:361
cjG @ loader.js:2232
(anonymous) @ VM3369:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
classLoadComplete @ loader.js:188
error (async)
loadScript @ loader.js:313
cheerpjLoadJarPackage @ loader.js:336
_m4VanRn3cGKuPdWarunFbsZWMJZK0ueWtrzeSNe9ZKebNxKp @ rt.jar.js:297
_m4VanRn3cGKuPdWarKnEbsZWMJZK0ueWtrzCmA0j1YINe9ZKebNxer @ rt.jar.js:324
_m4VanJm3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:324
_m4VanJm3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:324
_c4pbMxWAxsDjavJWbrKV2Zd3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:1777
loadWeakClass @ loader.js:361
cjG @ loader.js:2232
_c4VbzZ9ocdGbbIZT0dsDTOi6kHbI0ueMnDurjiaVceVa1Z8aq0a7dIK3R3l @ rt.jar.javax.imageio.js:253
_c4Vbz_9ocdGbbIZT0dsDTOi6kHbI0uegNT3R3l @ rt.jar.javax.imageio.js:253
_c4Vbzd_ocdGbbIZT0dsDTOi6kHbI0uewnVbXuhrba1YKyJ0eqJaH3Rhy2a @ rt.jar.javax.imageio.js:253
_c4VbzR8ocdGbbIZUirhGSiACS3R3l @ rt.jar.javax.imageio.js:368
N5javax7imageio7ImageIOX @ rt.jar.javax.imageio.js:358
cjG @ loader.js:2236
(anonymous) @ VM3358:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
classLoadComplete @ loader.js:188
error (async)
loadScript @ loader.js:313
cheerpjLoadJarPackage @ loader.js:336
_m4VanRn3cGKuPdWarunFbsZWMJZK0ueWtrzeSNe9ZKebNxKp @ rt.jar.js:297
_m4VanRn3cGKuPdWarKnEbsZWMJZK0ueWtrzCmA0j1YINe9ZKebNxer @ rt.jar.js:324
_m4VanJm3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:324
_m4VanJm3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:324
_c4pbMxWAxsDjavJWbrKV2Zd3cGKuPdabzjaMczqrpeSNe9h8mtteCEr1a @ rt.jar.js:1777
loadWeakClass @ loader.js:361
cjG @ loader.js:2232
(anonymous) @ VM3347:3
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
cheerpjParkTimeoutHandler @ rt.jar.js:1875
setTimeout (async)
_c4pbMBWAq72ibuqG_aeP4np69c @ rt.jar.js:1875
_i4pbNkarcKUa2iG3cuLal6D$IJGIuDDPJGcl1ZJt0u_dqKYjqJJKhd9NmAqcHW0O3l @ rt.jar.java.util.concurrent.locks.js:17
_i4pbNkarcKUa2iG3cuLalIE$IJGIeUTwG0ueGWKkfbfXalwJWrKtdsgrKpNtZacb8mmAqIbh1SfaY0jqJJK3O3i @ rt.jar.java.util.concurrent.locks.js:86
_i4pbNkarcKUa2iG3cuLalkars3rSaGPsrqrGpbOq496DLkbVxukc4b @ rt.jar.java.util.concurrent.js:946
(anonymous) @ VM3219:4
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
cheerpjParkTimeoutHandler @ rt.jar.js:1875
setTimeout (async)
_c4pbMBWAq72ibuqG_aeP4np69c @ rt.jar.js:1875
_i4pbNkarcKUa2iG3cuLal6D$IJGIuDDPJGcl1ZJt0u_dqKYjqJJKhd9NmAqcHW0O3l @ rt.jar.java.util.concurrent.locks.js:17
_i4pbNkarcKUa2iG3cuLalIE$IJGIeUTwG0ueGWKkfbfXalwJWrKtdsgrKpNtZacb8mmAqIbh1SfaY0jqJJK3O3i @ rt.jar.java.util.concurrent.locks.js:86
_i4pbNkarcKUa2iG3cuLalkars3rSaGPsrqrGpbOq496DLkbVxukc4b @ rt.jar.java.util.concurrent.js:946
(anonymous) @ VM3129:4
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
cheerpjParkTimeoutHandler @ rt.jar.js:1875
setTimeout (async)
_c4pbMBWAq72ibuqG_aeP4np69c @ rt.jar.js:1875
_i4pbNkarcKUa2iG3cuLal6D$IJGIuDDPJGcl1ZJt0u_dqKYjqJJKhd9NmAqcHW0O3l @ rt.jar.java.util.concurrent.locks.js:17
_i4pbNkarcKUa2iG3cuLalIE$IJGIeUTwG0ueGWKkfbfXalwJWrKtdsgrKpNtZacb8mmAqIbh1SfaY0jqJJK3O3i @ rt.jar.java.util.concurrent.locks.js:86
(anonymous) @ VM3130:4
runContinuationStack @ loader.js:395
cheerpjSchedule @ loader.js:961
CheerpJToolkitQueueEvent @ rt.jar.com.js:391
CheerpJHandleMouseEvent @ rt.jar.com.js:682
AnnotateROI.html:1 Failed to load https://docs.google.com/forms/d/e/1FAIpQLScErDRKZvSy1JAdiRSZfAsjf711VWdSdkczuSYHfIHQbtyFXA/formResponse: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8888' is therefore not allowed access.