mardi 30 décembre 2014

exos de révision

http://www.exercices-corriges.com/2014/02/exercices-corriges-java-heritage.html#.VJXIbsAPwA
http://fr.wikibooks.org/wiki/Programmation_Java/Transtypage

dimanche 14 décembre 2014

Java sound example - how to play a sound file in Java

A simple Java "play sound file" example

Here's the source code for my Java sound file example:
import java.io.*;
import sun.audio.*;

public class JavaAudioPlaySoundExample
{
  public static void main(String[] args)
  throws Exception
  {
    // open the sound file as a Java input stream
    String gongFile = "/Users/al/DevDaily/Projects/MeditationApp/resources/gong.au";
    InputStream in = new FileInputStream(gongFile);
    // create an audiostream from the inputstream
    AudioStream audioStream = new AudioStream(in);
    // play the audio clip with the audioplayer class
    AudioPlayer.player.start(audioStream);
  }
}
As you can see from this source code, it's pretty easy to create a basic Java sound file player.
For more info: http://alvinalexander.com/java/java-audio-example-java-au-play-sound

samedi 6 décembre 2014

Partager votre fichier .Jar avec d'autres utilisateurs

Distributing the Application to Other Users

Now that you have verified that the application works outside of the IDE, you are ready to distribute it.
You can distribute the application by following these steps:
  1. Create a zip file that contains the application JAR file (AnotherGrep.jar) and the accompanying lib folder that contains swing-layout-1.0.jar.
  2. Send the file to the people who will use the application. Instruct them to unpack the zip file, making sure that the AnotherGrep.jar file and the lib folder are in the same folder.
    The users of your application should be able to run it by double-clicking the JAR file. 

Comment créer un exécutable JAR