27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Miscellaneous I<br />

They have special edition for <strong>Java</strong> which lets to write additional interface for<br />

configuring of program parameters during instalation.<br />

I need to know how to run Multiple JVMs on one machine. As far as I know if<br />

I run 2 different <strong>Java</strong> Programs on one machine at the same time, both of<br />

these programs use the SAME JVM. Is this statement right?<br />

Answer: NO!. Each invocation of the 'java' command creates a new and separate<br />

JVM, at least in those JVMs based on the Sun code, and getting them to<br />

cooperate on a shared <strong>Java</strong> task is not automatic, and definitely non-trivial.<br />

I am totally confused about the differences between the SDK, JDK and IDE<br />

products<br />

I am brand new to the world of <strong>Java</strong> and am most interested in learning the<br />

language. However, I am confused about the differences between the SDK, JDK and<br />

IDE products. I have gone to the Sun site and even some of the IDE vendor sites and<br />

I have yet to find something that tells me what the differences are between the three<br />

and which of the three I need to program in <strong>Java</strong>.<br />

I want to program using some form of IDE but do I need to separately download and<br />

install a SDK and/or JDK? Sun needs to improve their documentation for us new to<br />

the <strong>Java</strong> environment.<br />

Answer1: IDE is an acronym for _I_ntegrated _D_evelopment _E_nvironment. These<br />

products are the one stop shops for coding, running and debugging your code. Often<br />

these will include GUI based drag and drop form designers and "wizards" for the<br />

shells of common forms of code (Application, Applet, etc.) JBuilder is an IDE.<br />

The IDE may stand on its own, or it may act as a front end for a JDK.<br />

JDK is _J_ava _D_esign _K_it. A JDK is a command line based interface to the JVM,<br />

plus the classes. You are responsible for your own editors, creating code for GUI<br />

elements, and all code. All of the IDE's I have reviewed personally come with JDK or<br />

their own vendor's equivalent (JVM and class libraries). Some IDE's are capable of a<br />

sort of "upgrading" by downloading the latest JDK from Sun (JBuilder for example).<br />

Answer2: If you want to write a <strong>Java</strong> program using any editor and not an IDE then<br />

you would want to download the JDK. It will let you compile and run <strong>Java</strong> programs<br />

from the command line (like a DOS window).<br />

JDK stands for <strong>Java</strong> Development Kit and SDK stands for Standard Development<br />

Kit.<br />

<strong>Java</strong> comes in three versions - Standard, Enterprise, and Micro editions. JDK could<br />

be any one of the three. SDK is the standard one - this is the one most people use. If<br />

you want an IDE they typically come with a JDK so all you would need to do there is<br />

download the IDE and start using it.<br />

How does a java application stored within a jar file reference/edit/read other files (<br />

like .txt, or data files,) that are also within the jar file?<br />

Answer: Classes located in a JAR archive are loaded via a class loader whose<br />

purpose is to load classes form JAR archives. This ClassLoader implements the<br />

getResource and getResourceAsStream methods to retrieve files from the JAR file.<br />

So you can take any class from the JAR and say<br />

ClassName.class.getClassLoader().getResource("fname"); to get the resource and<br />

file:///F|/350_t/350_tips/miscellaneous-I.htm (3 of 11) [2002-02-27 21:18:44]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!