0

I've created a java app to parse movies with mediainfo library. On Windows OS it works well. On Mac OS : if the movie it's on external disk it works well too, but if the movie is on "HD MAC" (on Desktop or Download folder by example) it doesn't work.

Now if I launch my app with terminal command java -jar <myApp.jar> all works, wherever the movie is stored. What are the differences between java -jar <myApp.jar> and double clik on .jar to launch app?

Thanks.

if i launch with java -jar i have error

Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
        at addon.TorrentProcessor.generatePieceHashes(TorrentProcessor.java:361)
        at addon.TorrentProcessor.generatePieceHashes(TorrentProcessor.java:375)

this is the lines

public void generatePieceHashes(TorrentFile torr) {
        ByteBuffer bb = ByteBuffer.allocate(torr.pieceLength);
        int index = 0;
        long total = 0;
        torr.piece_hash_values_as_binary.clear();
        for (int i = 0; i < torr.name.size(); i++) {
            total += (Integer) torr.length.get(i);//
            File f = new File((String) torr.name.get(i));
            if (f.exists()) {
                try {
                    FileInputStream fis = new FileInputStream(f);
                    int read = 0;
                    byte[] data = new byte[torr.pieceLength];
                    while ((read = fis.read(data, 0, bb.remaining())) != -1) {
                        bb.put(data, 0, read);
                        if (bb.remaining() == 0) {
                            torr.piece_hash_values_as_binary.add(Utils.hash(bb.
                                    array()));
                            bb.clear(); // the error is here
                        }
                    }
                } catch (FileNotFoundException fnfe) {} catch (IOException ioe) {}
            }
        }
        if (bb.remaining() != bb.capacity())
            torr.piece_hash_values_as_binary.add(Utils.hash(Utils.subArray(
                    bb.array(), 0, bb.capacity() - bb.remaining())));
    }

else if i launch with double click no error. ?????

hugoclo
  • 13
  • 4

0 Answers0