⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch54.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 2 页
字号:


<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->










<font face="Arial,Helvetica" size="-1" color="#006666">

<b>Linux</b></font><p>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">











 

























<UL>



	<LI><A HREF="#Heading1">- 54 -</A>



	<UL>



		<LI><A HREF="#Heading2">Java and JavaScript</A>



		<UL>



			<LI><A HREF="#Heading3">What You Need</A>



			<LI><A HREF="#Heading4">NOTE</A>



			<LI><A HREF="#Heading5">The Java Language</A>



			<LI><A HREF="#Heading6">JavaScript and HTML</A>



			<LI><A HREF="#Heading7">Summary</A>



		</UL>



	</UL>



</UL>







<P>



<HR SIZE="4">







<H2 ALIGN="CENTER"><A NAME="Heading1<FONT COLOR="#000077">- 54 -</FONT></H2>



<H2 ALIGN="CENTER"><A NAME="Heading2<FONT COLOR="#000077">Java and JavaScript</FONT></H2>



<P>IN THIS CHAPTER</P>







<UL>



	<LI>What You Need 



	<P>



	<LI>The Java Language 



	<P>



	<LI>JavaScript and HTML  



</UL>







<P><BR>



A quick word before we start: We're not going to teach you how to program Java in



this chapter! There's far too much material to do justice to the subject in a few



pages. Instead, we'll look at what Java is and does, and some of the basic programming



aspects.</P>







<P>What is Java? Java is a programming language developed at Sun Microsystems. Sun



describes Java in press releases as &quot;a simple, object-oriented, distributed,



interpreted, robust, secure, architecture-neutral, portable, high-performance, multi-threaded,



and dynamic language.&quot; What does all that really mean? To start with, Java was



intended to be a much simpler object- oriented language to work with than C++ or



SmallTalk, both of which are large, cumbersome languages. By producing a small object-oriented



language, Sun's developers also made Java simple and much less prone to bugs than



are larger languages. Those are the simple and robust aspects of the language. The



small size of the Java language also contributes to performance.</P>







<P>Java is an interpretive language, meaning that each line of source code is read



by the Java interpreter and is executed on that basis, rather than as a compiled



executable. Actually, that's a bit of a simplification, because Java code is pseudo-compiled



to produce a binary object file, called a class file, that is non-hardware dependent



and can be read by any Java system. This approach might be slower than a true compiled



system, but by using a platform-neutral language (meaning there are no hardware or



operating-specific instructions in the language), Java source code can execute on



any system with a Java interpreter. That covers the architecture-neutral and portable



aspects of Sun's description. The distributed aspect derives naturally from these



points, because Java source code can be easily sent from one machine to another across



a network for execution. This allows a server to send Java code to clients, making



a distributed system (Java runs on the client and communicates back to the server).</P>







<P>Because Java can run on practically any operating system, it can take advantage



of the host operating system's features, such as UNIX's capability to handle multithreading.



Java by itself can be thought of as multithreaded, but the operating system contributes



a lot in this regard. Finally, the security aspect of Java was one of the design



principles of the development group. A secure method of transferring information



from client to server and vice versa was needed, and Java was designed to fill this



requirement.</P>







<P>To provide the client and server software components, Java is designed to have



the interpretive component of the language attached to other software, most commonly



a Web browser. Netscape's Navigator and Microsoft's Explorer, for example, both have



the client components of Java attached (or &quot;plugged in,&quot; in Web parlance)



to the browser code. When incoming Java source code is detected, the Java interpreter



starts and handles the task.</P>



<P>JavaScript was introduced after Java was on the market for a while. JavaScript



is built into most Java-enabled Web browsers. JavaScript and Java don't have much



in common, despite the name. Many people think of JavaScript as a stripped-down Java,



but that is incorrect and misleading. JavaScript is more an extension of HTML coding



that allows users to build interactive Web pages in a client-server system.</P>



<P>JavaScript has various uses that make it attractive, including the capability



to tell what a user is doing. When a user leaves a page or clicks a certain button,



the JavaScript client can communicate this information and start new routines. JavaScript



is also ideal for writing little housekeeping tasks and for managing complex tasks,



such as string handling, that are beyond HTML.



<H3 ALIGN="CENTER"><A NAME="Heading3<FONT COLOR="#000077">What You Need</FONT></H3>



<P>To write Java applications, you need the Java Developer's Kit (JDK). The JDK contains



all the software necessary to write, compile, and test Java applets. Besides the



JDK, all you need is a Java-enabled browser to test and display your applets. Netscape



Navigator's and Microsoft Explorer's latest releases all support Java, as do many



other browsers. Sun developed its own Java-enabled browser called HotJava, which



is available from the Sun Web site.







<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading4<FONT COLOR="#000077"><B>NOTE: </B></FONT>You can get the



	JDK at many sites on the Web or through FTP. The primary location is the Sun page



	<TT>http://java.sun.com</TT>, although most Linux sites also contain pointers to



	mirrors or backup sites for the JDK. For a Java-enabled Web browser, check out both



	Netscape and Microsoft home pages, as well as Sun's HotJava. For other browsers and



	Java development tools, check the Linux sites on the Web. For FTP access to the JDK,



	FTP to <TT>java.sun.com</TT> and change to the directory <TT>/pub</TT>, which contains



	the files you need.



<HR>







</DL>







<P>The Sun Java section also contains a wealth of details on Java development, lots



of sample code, advice, and FAQs. A white paper on Java obtained at the same site



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -