projectkillo.blogg.se

Export a bluej program
Export a bluej program








  1. Export a bluej program full#
  2. Export a bluej program code#

Start BlueJ and open the Calculator project. You could do these changes manually, or simply copy-and-paste the new applet from below as follows: We remove the last two lines from the init method that say “ pack()” and “ setVisible(true)”. We change the constructor name (the method with the same name as the class name) to public void init We change the superclass from JFrame to JApplet We remove the main method at the end of the applet We need to make sure that we change all occurrences of CalcProgram to CalcApplet, and that the new class is saved as CalcApplet.java

export a bluej program

We change the name of the class to CalcApplet instead of CalcProgram.

Export a bluej program code#

The changes are outlined here, but the new, changed code is listed below for your reference. To turn the program into an applet, we need to make just a few changes. Public void actionPerformed(ActionEvent e)ĭouble x = Double.parseDouble(num1.getText()) ĭouble y = Double.parseDouble(num2.getText()) GetContentPane().setLayout(new BorderLayout()) JPanel buttons = new JPanel(new FlowLayout()) JPanel fields = new JPanel(new FlowLayout()) JTextField num2 = new JTextField("0.00") JTextField num1 = new JTextField("0.00") Public class CalcProgram extends JFrame implements ActionListener Open the CalcProgram class and delete everything it containsĬopy the program listed below and paste it into the CalcProgram class Name the project CalculatorĬreate a new class in your project. To ‘cut-and-paste’ this program into BlueJ, do the following: The code for that program is listed below. In class we developed the Calculator program to add and subtract two numbers. Changing the Calculator Program to a Calculator Applet

export a bluej program

I have to change directory (cd) to get the correct paths for the. Jar -ufm %JarName% HTTPServer.mnf HTTPServerFmJar.bat *.ini servlet.properties M圜hat\*.classĮCHO - Created: %JarName% Remember to copy to \www for server Jar -cf %JarName% HTTPServer\*.class NormsDev\Timer*.class Servlets\*.class NormsTools\SaveStdOutput*.class NormsDev\WarningBox*.class NormsTools\GetIntInput*.class NormsTools\GetInput*.class NormsTools\MakeEnterDoAction*.class NormsTools\EnvironVars*.class NormsTools\FindOurHome*.class NormsTools\FindInTA*.class NormsTools\ErrDialog*.class NormsTools\MessageArea*.class NormsTools\ChoiceOfYesOrNo*.classĬd %DEV_HOME%\JavaDevelopment\HTTPServer\ SET JarName=%DEV_HOME%\JavaDevelopment\HTTPServer\HTTPServer.jar Here's a batch file I use to create a jar Create the HTTPServer.jar file: You do that by issuing the jar command in the folder that contains the start of the package path. class files in the jar file must be in folders/have paths that match the package they are in. This is what I get back:Įxception in thread "main" : org/jfree/panning/XYPLOTĬaused by: : Īt $1.run(URLClassLoader.java:202)Ĭould not find the main class: org/jfree/panning/XYPLOT. Program will exit.Īfter it tells me that "XYPLOT" is the wrong name and says "org/jfree/panning/XYPLOT", I decide to make "org/jfree/panning/XYPLOT" the Main-Class path. jar produced, this is what command prompt gives me:Ĭ:\Users\Luke\Desktop\>java -jar XYPLOT.jarĮxception in thread "main" : XYPLOT (wrong name: org/jfree/panning/XYPLOT)Īt 1(Native Method)Īt (ClassLoader.java:632)Īt (ClassLoader.java:616)Īt (SecureClassLoader.java:141)Īt (URLClassLoader.java:283)Īt $000(URLClassLoader.java:58)Īt $1.run(URLClassLoader.java:197)Īt (Native Method)Īt (URLClassLoader.java:190)Īt (ClassLoader.java:307)Īt $AppClassLoader.loadClass(Launcher.java:301)Īt (ClassLoader.java:248)Ĭould not find the main class: XYPLOT. The first time I try to run the executable. jar executable that is made is called XYPLOT.jar. I compile a jar and modify the MANIFEST.MF inside to include the Main-Class line and the Class-Path line. Inside the folder I have the third party library. So I created a folder off my desktop called.

Export a bluej program full#

The full contents of the command prompt window when you try to execute the jar file.

export a bluej program

Use the jar command to put the manifest and class files into the jar file. A screwup anywhere will cause it to fail.Ĭreate a manifest file with the Main-Class: lineĪdd a Class-path: line for your third party jarĬompile all the class files into a folder matching their packages There are several steps to putting an app in a jar.










Export a bluej program