Guest User

Untitled

a guest
Jun 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. C:Usersoreyessamplesjavacreate-jar>type HelloWorldSwing.java
  2. package start;
  3.  
  4. import javax.swing.*;
  5.  
  6. public class HelloWorldSwing {
  7. public static void main(String[] args) {
  8. //Create and set up the window.
  9. JFrame frame = new JFrame("HelloWorldSwing");
  10. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  11.  
  12. JLabel label = new JLabel("Hello World");
  13. frame.add(label);
  14.  
  15. //Display the window.
  16. frame.pack();
  17. frame.setVisible(true);
  18. }
  19. }
  20. class Dummy {
  21. // just to have another thing to pack in the jar
  22. }
  23.  
  24. C:Usersoreyessamplesjavacreate-jar>javac -d . HelloWorldSwing.java
  25.  
  26. C:Usersoreyessamplesjavacreate-jar>dir start
  27.  
  28. Directorio de C:Usersoreyessamplesjavacreate-jarstart
  29.  
  30. 29/04/2009 06:56 p.m. <DIR> .
  31. 29/04/2009 06:56 p.m. <DIR> ..
  32. 29/04/2009 06:58 p.m. 200 Dummy.class
  33. 29/04/2009 06:58 p.m. 622 HelloWorldSwing.class
  34. 2 archivos 822 bytes
  35.  
  36. C:Usersoreyessamplesjavacreate-jar>type manifest.mf
  37. Main-class: start.HelloWorldSwing
  38.  
  39. C:Usersoreyessamplesjavacreate-jar>jar -cmf manifest.mf hello.jar start
  40.  
  41. java YourClass
  42.  
  43. jar -cvf [name of jar file] [name of directory with Java files]
  44.  
  45. Main-Class: [fully qualified name of your main class]
  46.  
  47. java -jar [name of jar file]
Add Comment
Please, Sign In to add comment