why when i export my sketch ( creat an app) i can't read it after ?

Answers

  • @Chrisir ? any idea ?

  • Operating system?

  • I'm not sure about that the screen still white but the sound is playing

  • Operating system?

    Kf

  • Nope i don't think it's that... i've checked and with another sketch it works fine

  • but you need to tell us which operating system you are using so we know how to answer...

  • because 3 words and a unhappy face isn't quite enough detail

  • windows7

  • What do you mean you can't read it after? Are you loading any resources like images? Are they in the right place?

    Kf

  • Yes I do, I can execute the sketch but when I export it nothing works

  • for someone who wants a problem solved you aren't helping much.

    post the code.

  • That's a bunch of external jars and data.

    Are they all included in the exported directory?

  • edited May 2017

    Aha yes ^^.

    Yes all of them

  • edited May 2017

    i don't have windows 7 so i'm not sure how much help this will be but when export and run that i get

    ./projet_final_fleches 
    ==== JavaSound Minim Error ====
    ==== Don't know the ID3 code TXXX
    
    ==== JavaSound Minim Error ====
    ==== Don't know the ID3 code TDRL
    
    ==== JavaSound Minim Error ====
    ==== Don't know the ID3 code TXXX
    
    ==== JavaSound Minim Error ====
    ==== Don't know the ID3 code TSSE
    
    The file "leaderboard.txt" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
    Le fichier a bien été upload
    java.lang.NullPointerException
        at projet_final_fleches.setup(projet_final_fleches.java:139)
        at processing.core.PApplet.handleDraw(PApplet.java:2393)
        at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1540)
        at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
    

    the id3 errors you can ignore.

    i'd fix the leaderboard.txt problem, maybe just create an empty one

    [edit, it's not the wav file]

    the app does run here (linux64) in as much as i get the music but only ever see a white square.

  • edited May 2017 Answer ✓

    ok, it's not the wav file.

    looking again the problem is here:

      //Cr\u00e9ation d'unb tableau afin de r\u00e9cup\u00e9rer les donn\u00e9es du dernier jeu  
      String score[] = loadStrings("leaderboard.txt");
      println("Le fichier a bien \u00e9t\u00e9 upload");
      //Affichage dans la console des derniers temps \u00e0 partir du fichier texte  
      for (int i = 1; i < score.length; i++) {
    

    that last line there. score is null because the leaderboard file doesn't exist so score.length gives a NPE.

  • edited May 2017

    ohhhh okay I see I just have to create the leaderboard text before uploading the file ?!

  • NPE ?

    null pointer exception

  • ^^ i am really tyred :D

  • Answer ✓

    (i've edited the previous messages, i was wrong about the wav file)

    that's working when i add a leaderboard file.

    beware though that loadStrings() will look in data directory for a file but createwriter will write a file to the sketch directory, not the data directory. so put your initial leaderboard.txt file in the sketch directory, not the data directory.

  • i've moved the

         output = createWriter("leaderboard.txt");        //Création d'un nouveau fichier
    

    before this

     String score[] = loadStrings("leaderboard.txt"); 
    

    and it works fine :) thanks

  • that'll work, yes

  • but the problem now is that i can't have the time from the game before cause every time we open the game a new file will be created

  • Answer ✓

    you can scores = loadStrings("leaderboard.txt"); and then check scores and if it is null then call createWriter() to create the file (and set scores = new String[0]; to stop the npe)

    alternatively, just add an empty leaderboard.txt to your sketch folder. you could even put some scores in it to start with, give them something to aim for.

  • it's better thank's very much

Sign In or Register to comment.