<< Chapter < Page Chapter >> Page >

Create a file named SvgLib21.java that contains an exact replica of the Java code in Listing 26 . Store that file in the same folder as your Java program.

Create a batch file (or whatever the equivalent is for your operating system) containing the text shown in Listing 24 .

Then execute the batch file.

If everything is successful, a Firefox window should open showing your drawing ready to be printed.

Listing 24 . Windows batch file.
cls del *.classdel Svg21a.svg javac -cp ".;C:\Program Files (x86)\Java\jdom-1.1.1\build\jdom.jar" SvgLib21.javajavac -cp ".;C:\Program Files (x86)\Java\jdom-1.1.1\build\jdom.jar" Svg21a.java java -cp ".;C:\Program Files (x86)\Java\jdom-1.1.1\build\jdom.jar" Svg21astart Firefox.exe Svg21a.svg pause

Comments regarding the batch file

Note that the text inside the quotation marks is the same as the location where I stored the file named jdom.jar . In fact, it is identical except that ".;" appears before that location in Listing 24 . You need to cause your batch file to identify the location of the file named jdom.jar on your system just like I did in Listing 24 .

Do not modify the text that reads "SvgLib21.java" in Listing 24 .

Replace the text that reads "Svg21a" in all three locations in Listing 24 with the name of your program. Note, however, that the first time it appears, itis specifying the name of the output SVG file. In case you elected to give your output SVG file a different name than the name of your program, you need toinsert that name in place of Svg21a.svg .

Starting the browser automatically

Listing 24 also assumes that you have Firefox 5 or later installed on your system and starts it running automatically . (It will probably also work with earlier versions of Firefox. However, Ihave been unable to cause either Google Chrome or IE 9 to start automatically using this approach.)

In any event, the last line of text before the pause can be deleted from Listing 24 with no harmful effects. It simply won't start the browserautomatically if you delete that text. In that case, you will have to manually open the output SVG file in the browser (or in some other SVG processor program) in order to print it. (Opening the SVG file manually seems to work in Firefox 5, IE 9, and Google Chrome 12.)

Don't delete the pause command

The pause command causes the command-line window to stay on the screen. You will need to examine the contents of the window if there are errorswhen you attempt to compile and run your program, so don't delete the pause command.

Translate to other operating systems

Remember, the format of the batch file in Listing 24 is a Windows format. If you are using a different operating system, you will need to translate theinformation in Listing 24 into the correct format for your operating system.

Resources

I will publish a module containing consolidated links to resources on my Connexions web page and will update and add to the list as additional modulesin this collection are published.

Complete program listings

Complete listings of the three programs discussed in this module are provided in Listing 25 , Listing 26 , and Listing 27 .

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask