??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美大片一区二区,中文字幕日韩精品有码视频,国产精品久久中文http://www.aygfsteel.com/cjren/化繁为简Q相寚w中,数Şl合zh-cnSat, 17 May 2025 20:00:02 GMTSat, 17 May 2025 20:00:02 GMT60Some website to remember for 3D-tech-Originalhttp://www.aygfsteel.com/cjren/archive/2006/10/31/78183.htmlcjrencjrenMon, 30 Oct 2006 16:11:00 GMThttp://www.aygfsteel.com/cjren/archive/2006/10/31/78183.htmlhttp://www.aygfsteel.com/cjren/comments/78183.htmlhttp://www.aygfsteel.com/cjren/archive/2006/10/31/78183.html#Feedback0http://www.aygfsteel.com/cjren/comments/commentRss/78183.htmlhttp://www.aygfsteel.com/cjren/services/trackbacks/78183.htmlhttp://www.csit.fsu.edu/~burkardt/data/data.html
可以从中扑ֈ大部分文件格式的相关信息。例如BMPQObj{等?br />
http://www.csit.fsu.edu/~burkardt/data/obj/obj.html
介绍OBJ文g格式Q关键是当中提供了读写和转换OBJ文g的工具徏议?br />


cjren 2006-10-31 00:11 发表评论
]]>
Something you want to know about the basics of java -java-tech-?/title><link>http://www.aygfsteel.com/cjren/archive/2006/07/23/59695.html</link><dc:creator>cjren</dc:creator><author>cjren</author><pubDate>Sun, 23 Jul 2006 12:14:00 GMT</pubDate><guid>http://www.aygfsteel.com/cjren/archive/2006/07/23/59695.html</guid><wfw:comment>http://www.aygfsteel.com/cjren/comments/59695.html</wfw:comment><comments>http://www.aygfsteel.com/cjren/archive/2006/07/23/59695.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/cjren/comments/commentRss/59695.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/cjren/services/trackbacks/59695.html</trackback:ping><description><![CDATA[ <p> <img height="490" alt="helloWorldEg.jpg" src="http://www.aygfsteel.com/images/blogjava_net/cjren/helloWorldEg.jpg" width="700" border="0" /><br />׃q图Q仔l看看和联想一下,也许会有点得?-)</p> <img src ="http://www.aygfsteel.com/cjren/aggbug/59695.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/cjren/" target="_blank">cjren</a> 2006-07-23 20:14 <a href="http://www.aygfsteel.com/cjren/archive/2006/07/23/59695.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>The Life Cycle of a Thread-java-tech-?/title><link>http://www.aygfsteel.com/cjren/archive/2006/07/23/59693.html</link><dc:creator>cjren</dc:creator><author>cjren</author><pubDate>Sun, 23 Jul 2006 12:10:00 GMT</pubDate><guid>http://www.aygfsteel.com/cjren/archive/2006/07/23/59693.html</guid><wfw:comment>http://www.aygfsteel.com/cjren/comments/59693.html</wfw:comment><comments>http://www.aygfsteel.com/cjren/archive/2006/07/23/59693.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/cjren/comments/commentRss/59693.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/cjren/services/trackbacks/59693.html</trackback:ping><description><![CDATA[What do you know The Life Cycle of a Thread? <br /><img height="1" src="/WebResource.axd?d=pLXXeGbWF7eXU8SMs2-GFZvUWY2JNH05dFx5YzJhGUYAYJAFEaTEq36NAhTPy7_KekvzDFwt8wvQWdByvJIGWdEq6x2KpKD80&t=632785713320000000" width="1" /><img height="173" alt="threads-states.gif" src="http://www.aygfsteel.com/images/blogjava_net/cjren/threads-states.gif" width="421" border="0" /><br />Can you say something about the life cycle of a thread, it's creating, starting, running, not runnale, and stopping? If you do want to know about more, please check it out: <a >http://java.sun.com/docs/books/tutorial/essential/threads/lifecycle.html</a><br /><img src ="http://www.aygfsteel.com/cjren/aggbug/59693.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/cjren/" target="_blank">cjren</a> 2006-07-23 20:10 <a href="http://www.aygfsteel.com/cjren/archive/2006/07/23/59693.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>法斚w的书c三?tech-?/title><link>http://www.aygfsteel.com/cjren/archive/2006/07/23/59690.html</link><dc:creator>cjren</dc:creator><author>cjren</author><pubDate>Sun, 23 Jul 2006 11:38:00 GMT</pubDate><guid>http://www.aygfsteel.com/cjren/archive/2006/07/23/59690.html</guid><wfw:comment>http://www.aygfsteel.com/cjren/comments/59690.html</wfw:comment><comments>http://www.aygfsteel.com/cjren/archive/2006/07/23/59690.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/cjren/comments/commentRss/59690.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/cjren/services/trackbacks/59690.html</trackback:ping><description><![CDATA[ <p>(1)<br />The Art of Programming Language<br />《计机E序设计艺术?清华大学出版C?/p> <p>(2)<br />Introduction to Algorithms, Second Edition<br />Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein<br />MIT <br />《算法导论,影印版》高{教育出版社</p> <p>(3)<br />Intruduction to The Design and Analysis of Algorithms <br />(US)Anany Levitin <br />法设计与分析基 <br />潘R 译?<br />清华大学出版C?br /><br />其实W一本我没有看过Q只是提及算法方面的书籍Q这一本好像都应该Zh所知道似的。第二本的课E资料可以在mit的open course ware面下蝲。第三本的译本很不错Q感觉很有点q默有趣Q而且书的l构挺新颖,不至于让人马上对法q东西觉得恐怖和烦闷。推荐第三本?/p> <img src ="http://www.aygfsteel.com/cjren/aggbug/59690.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/cjren/" target="_blank">cjren</a> 2006-07-23 19:38 <a href="http://www.aygfsteel.com/cjren/archive/2006/07/23/59690.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>手机2G(2??G(2?的GSM和CDMA{概?untech-?/title><link>http://www.aygfsteel.com/cjren/archive/2006/07/23/59689.html</link><dc:creator>cjren</dc:creator><author>cjren</author><pubDate>Sun, 23 Jul 2006 11:28:00 GMT</pubDate><guid>http://www.aygfsteel.com/cjren/archive/2006/07/23/59689.html</guid><wfw:comment>http://www.aygfsteel.com/cjren/comments/59689.html</wfw:comment><comments>http://www.aygfsteel.com/cjren/archive/2006/07/23/59689.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/cjren/comments/commentRss/59689.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/cjren/services/trackbacks/59689.html</trackback:ping><description><![CDATA[ <p>Ud -- 只有GSMQGPRS是GSM的升U版Q?34-139 手机使用Ud的SIM卡      ?</p> <p>联?-- GSM  130,131,132       手机使用联通SIM?br />         -- CDMA 133 (联通新时空)Q手Z用UIM?/p> <p> <br />GSM比较单。所谓的GSM 900/1800/1900是指GSM手机的工作频率,分别是中国移动支持的900MHzQ?900MHz和美国常用的1900MHz。在国内用支?00MHz?800MHz的GSM 900/1800双频手机可以了。如果要出国到美国用的,p用支?900MHz的三频手Z?/p> <p>CDMA比GSM的通话质量、手小和保密性方面都好,但是技?=市场?br />CDMA -- CDMA800<br />            -- CDMA 1X 现在联通CDMA|络所采取的技术。与真正的CDMA2000相比QCDMA 1x像我刚才说的,只能支持?53.6kbps的数据速度Q因此被UCؓ?.5G的技术,q不是真?G的技术?br />            -- CDMA2000 一U?G的标准?/p> <p> <br />3G 有三个标?br />            -- WCDMA 有利于中国移动,讑֤由欧z进口,Ҏ升到WCDMA。这套系l能够架讑֜现有的GSM|络上,对于pȝ提供商而言可以较轻易地q渡Q而GSMpȝ相当普及的亚z对q套新技术的接受度预料会相当高。因此W-CDMAh先天的市Zѝ?br /> <br />             -- CDMA2000 利于联通,讑֤q国进口,Ҏ升到CDMA2000。目前用CDMA的地区只有日、韩和北,所以CDMA2000的支持者不如W-CDMA多。不qCDMA2000的研发技术却是目前各标准中进度最快的Q许?G手机已经率先面世?</p> <p>             -- TD-SCDMA 中国自己有独立知识权的产品。采用这一标准Q对于国防等重要领域国民l济安全有利。据说中国电信和中国|通都在申L动运营牌照,他们們֐于TDS-CDMA?br />       至于现在中国采用哪一U现在还没有定论。毕竟需要市场和企业来最l决定,C技术优U的ƈ不代表最l就能胜出?br /></p> <img src ="http://www.aygfsteel.com/cjren/aggbug/59689.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/cjren/" target="_blank">cjren</a> 2006-07-23 19:28 <a href="http://www.aygfsteel.com/cjren/archive/2006/07/23/59689.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>"Computer science is no more about computers than astronomy is about telescopes."-untech-?/title><link>http://www.aygfsteel.com/cjren/archive/2006/07/08/57238.html</link><dc:creator>cjren</dc:creator><author>cjren</author><pubDate>Sat, 08 Jul 2006 02:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/cjren/archive/2006/07/08/57238.html</guid><wfw:comment>http://www.aygfsteel.com/cjren/comments/57238.html</wfw:comment><comments>http://www.aygfsteel.com/cjren/archive/2006/07/08/57238.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/cjren/comments/commentRss/57238.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/cjren/services/trackbacks/57238.html</trackback:ping><description><![CDATA[ <p>"Computer science is no more about computers than astronomy is about telescopes." </p> <p align="left">                                                  E. W. Dijkstra <br />计算机是一个工P一个h造的工具Qh刉工L目的是什么?协助自己完成生力_Q或切地说是完成自q存和生活的需要。由于需要完成大量的q算而生的计算机,即是到现在也局限于信息的处理,包括单的q算和信息(数字Q的存储?br /><br />而在学习当中Q“sprintQstruct”等q些名字听v来真的很大,而我帔R自己“我需要学习它吗?”。是否不懂它们就不算懂java了呢Q我?月䆾开始觉得java自p来越q了Q因为我上许多的关于java的论坛,看到的极大部分都是讨论框Ӟ而我Ҏ没有什么概c“需求驱动学习”是我的信条Q没有这个需求,你就没有学习那相应知识的必要Q更没有动力。也许这是我懒的借口:-) 大概是自己尚且是学生Q没有投w都企业生当中因此对这些企业开发的知识没有概念吧。反正觉得现在没有学q个的必要,谁知道两q后是否有什么summer or XXname的框架出现呢Q?br /><br />q个暑假其实自己q是x握时间看看书的,反正又没有找到实习工作。例如data structure & algorithmQ算法分析这门课没有学过Q真的遗憾,只能自己补补Q还有那Developing Games in Java的part 3Q当中讲的是3d的renderringQ而不涉及opengl以及java3d或opengl binding{APIQ自p是很有兴的。而昨天在国外的大学的|站上下载了一个OS评的lecture notesQ正好复习一下操作系l的概念?br /><br /></p> <img src ="http://www.aygfsteel.com/cjren/aggbug/57238.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/cjren/" target="_blank">cjren</a> 2006-07-08 10:25 <a href="http://www.aygfsteel.com/cjren/archive/2006/07/08/57238.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Storage and Dynamic Storage-tech-摘录http://www.aygfsteel.com/cjren/archive/2006/07/07/57088.htmlcjrencjrenFri, 07 Jul 2006 02:49:00 GMThttp://www.aygfsteel.com/cjren/archive/2006/07/07/57088.htmlhttp://www.aygfsteel.com/cjren/comments/57088.htmlhttp://www.aygfsteel.com/cjren/archive/2006/07/07/57088.html#Feedback0http://www.aygfsteel.com/cjren/comments/commentRss/57088.htmlhttp://www.aygfsteel.com/cjren/services/trackbacks/57088.html阅读全文

cjren 2006-07-07 10:49 发表评论
]]>
stack & heap (栈和?, 从C\java\pȝ三个角度看其区别-tech-摘录http://www.aygfsteel.com/cjren/archive/2006/07/06/56989.htmlcjrencjrenThu, 06 Jul 2006 09:30:00 GMThttp://www.aygfsteel.com/cjren/archive/2006/07/06/56989.htmlhttp://www.aygfsteel.com/cjren/comments/56989.htmlhttp://www.aygfsteel.com/cjren/archive/2006/07/06/56989.html#Feedback3http://www.aygfsteel.com/cjren/comments/commentRss/56989.htmlhttp://www.aygfsteel.com/cjren/services/trackbacks/56989.html 上午看某文章时候涉?strong>~冲区溢?/strong>的问题,谈到C的栈和堆Q有所不懂于是baidu了一下发现论坛上的解释都较ؓ凌ؕQgoogle一下后发现国外大学?font color="#006400">Lecture Notes 中有不少的说明,下面单的摘录三段Q一是c中的Q二是对于java的,三是从os角度看的?br />
Stack vs Heap Allocation
How the memory of the computer is organized for a running program? When a program is loaded into memory, it is organized into three areas of memory, called segments: the text segment, stack segment, and heap segment. The text segment (sometimes also called the code segment) is where the compiled code of the program itself resides. This is the machine language representation of the program steps to be carried out, including all functions making up the program, both user defined and system.

The remaining two areas of system memory is where storage may be allocated by the compiler for data storage. The stack is where memory is allocated for automatic variables within functions. A stack is a Last In First Out (LIFO) storage device where new storage is allocated and deallocated at only one ``end'', called the Top of the stack. This can be seen in Figure 14.13. 
 figure14.13.gif

When a program begins executing in the function main(), space is allocated on the stack for all variables declared within main(), as seen in Figure 14.13(a). If main() calls a function, func1(), additional storage is allocated for the variables in func1() at the top of the stack as shown in Figure 14.13(b). Notice that the parameters passed by main() to func1() are also stored on the stack. If func1() were to call any additional functions, storage would be allocated at the new Top of stack as seen in the figure. When func1() returns, storage for its local variables is deallocated, and the Top of the stack returns to to position shown in Figure 14.13(c). If main() were to call another function, storage would be allocated for that function at the Top shown in the figure. As can be seen, the memory allocated in the stack area is used and reused during program execution. It should be clear that memory allocated in this area will contain garbage values left over from previous usage.

The heap segment provides more stable storage of data for a program; memory allocated in the heap remains in existence for the duration of a program. Therefore, global variables (storage class external), and static variables are allocated on the heap. The memory allocated in the heap area, if initialized to zero at program start, remains zero until the program makes use of it. Thus, the heap area need not contain garbage.
结Q?br />Stack: automatic variables within functions
Heap: global variables (storage class external), and static variables
============================
In java 情况如下
(1)
 The stack is the program memory area, so all your primitive type variables and the memory adress of your objects are written on the stack. It is a fast access valuable memory area.
The heap is where the VM keeps the objects, and it is a huge amount of memory. When you create an object, the VM puts the object in the HEAP and puts the adress of the object created on the STACK.
(2)
 There are two kinds of memory used in Java. These are called stack memory and heap memory. Stack memory stores primitive types and the addresses of objects. The object values are stored in heap memory. An object reference on the stack is only an address that refers to the place in heap memory where that object is kept.
 It is useful to know that these two different kinds of memory exist in Java. Stack memory is the program's memory, and heap memory resides outside of the program.q好像有点跟C的不同(相反Q?br />引入一点垃圑֛收机制的知识
 When you need a new object, Java allocates the required memory. When you are done with an object, the memory is reclaimed for you automatically via Java's garbage collection facility.
 Garbage collection runs as a thread in the background, looking for objects that no longer have a usable reference. When it finds them, it destroys them and reclaims the memory.
 The implementation of garbage collection varies between Java Virtual Machines. They generally follow the same process, however. First, the garbage collector gets a snapshot of all running threads and all loaded classes. Then, all objects that are referred to by this thread set are marked as current. The process stops when all objects that it is possible to reach have been marked and the rest have been discarded.
 In order to help the Virtual Machine, it is a good idea to remove your references to unneeded objects. This is often done by simply setting your reference to null:
 Test t = new Test();
 t.someAction();
 // all done
 t = null;
结Q?br />Stack: Primitive data types(primitive types), the addresses of objects(=references).
Heap:  objects.

===============================================
从系l的角度?stackQ栈Q和heap(堆)
Dynamic Data Structures: The Heap
A typical personal computer or workstation today has somewhere between 16 and 64 megabytes of RAM installed. Using a technique called virtual memory, the system can swap pieces of memory on and off the machine's hard disk to create an illusion for the CPU that it has much more memory, for example 200 to 500 megabytes. While this illusion is complete as far as the CPU is concerned, it can sometimes slow things down tremendously from the user's perspective. Despite this drawback, virtual memory is an extremely useful technique for "increasing" the amount of RAM in a machine in an inexpensive way. Let's assume for the sake of this discussion that a typical computer has a total memory space of, for example, 50 megabytes (regardless of whether that memory is implemented in real RAM or in virtual memory).
The operating system on the machine is in charge of the 50-megabyte memory space. The operating system uses the space in several different ways, as shown here:

 c-heap.gif
The operating system and several applications, along with their global variables and stack spaces, all consume portions of memory. When a program completes execution, it releases its memory for reuse by other programs. Note that part of the memory space remains unused at any given time.

This is, of course, an idealization, but the basic principles are correct. As you can see, memory holds the executable code for the different applications currently running on the machine, along with the executable code for the operating system itself. Each application has certain global variables associated with it. These variables also consume memory. Finally, each application uses an area of memory called the stack, which holds all local variables and parameters used by any function. The stack also remembers the order in which functions are called so that function returns occur correctly. Each time a function is called, its local variables and parameters are "pushed onto" the stack. When the function returns, these locals and parameters are "popped." Because of this, the size of a program's stack fluctuates constantly as the program is running, but it has some maximum size.

As a program finishes execution, the operating system unloads it, its globals and its stack space from memory. A new program can make use of that space at a later time. In this way, the memory in a computer system is constantly "recycled" and reused by programs as they execute and complete.

In general, perhaps 50 percent of the computer's total memory space might be unused at any given moment. The operating system owns and manages the unused memory, and it is collectively known as the heap. The heap is extremely important because it is available for use by applications during execution using the C functions malloc (memory allocate) and free. The heap allows programs to allocate memory exactly when they need it during the execution of a program, rather than pre-allocating it with a specifically-sized array declaration.



cjren 2006-07-06 17:30 发表评论
]]>
package & import-java-tech-原创http://www.aygfsteel.com/cjren/archive/2006/07/06/56888.htmlcjrencjrenThu, 06 Jul 2006 01:00:00 GMThttp://www.aygfsteel.com/cjren/archive/2006/07/06/56888.htmlhttp://www.aygfsteel.com/cjren/comments/56888.htmlhttp://www.aygfsteel.com/cjren/archive/2006/07/06/56888.html#Feedback3http://www.aygfsteel.com/cjren/comments/commentRss/56888.htmlhttp://www.aygfsteel.com/cjren/services/trackbacks/56888.html
在尝试徏立自q可重用package的时候,对package和import语句做了些试验,记录l果如下?/p>

使用说明Q?br />(1)对于src\com\cjren\util\ClassA.javaq个提供l其他类使用的class.
package com.cjren.util;
public class ClassA {
  ...
}
~译?
javac -d . ClassA.java  // -d . 表示了以当前目录为package语句生成的相Ҏ目录?br />l果是在ClassA.java所在的目录下生成了com.cjren.util包,里面含ClassA.classQ这个包可以复制剪脓到其他的地方供其他类使用?br />Notes:
必须使用"-d ."Q否则ClassA.classq不会放在com.cjren.util包里面,而是生成在和ClassA.java相同的目录下?/p>


(2)对于要用ClassA的ClassB.java.
import com.cjren.util.ClassA;
public class ClassB {
  ... // use ClassA here
}

To compile: javac ClassB.java
To run:     假设com包放在和ClassB.java的当前目?br />            java ClassB       
            // or java -cp . ClassB // here use the "-cp ." as the current directory to find the package com.
            假设com包放在D:\Program Files\Java\mypackages?br />            java -cp D:\Program Files\Java\mypackages ClassB

Notes:
错误一Q?br />package com.cjren.util;
public class ClassA {
  ...
}
~译后直接把com.cjren.util包里面的ClassA.class文g拯到和ClassB.java相同的目录下直接使用Q?br />public class ClassB {
  ... // use ClassA here
}
To compile: javac ClassB.java
错误信息?br />"ClassB.java:某一? 无法讉K ClassA
 错误的类文gQ?.\ClassA.class
 cL件包含错误的c: com.cjren.util.ClassA
 请删除该文g或确保该文g位于正确的类路径子目录中?
想一想ؓ什么出错信息是_“错误的cLӞ .\ClassA.classQ?cL件包含错误的c: com.cjren.util.ClassA”呢Q因?错误的类文gQ?.\ClassA.class"当中包含?错误的类Q?com.cjren.util.ClassA"q个信息Q而这?com.cjren.util.ClassA"是在ClassA.java中的"package com.cjren.util;"语句所造成的?br />正确的做法是把ClassA.class所在的包整个复制粘贴到ClassB.java所在的目录下,或者在ClassB.java所在的目录下h为手动的建立com\cjren\util\目录Q然后直接把ClassA.class文g复制_脓到此。这暗示了代码生成的包和手动建立的目录可能是一栗?br />可见,当ClassA.java的源代码中含"package com.cjren.util;"语句Q则生成com.cjren.util包里面的ClassA.class文g里面应该׃包含了自p个class文g所属的包信息,所以这个ClassA.class只能攑֜q个代码中已l指定的特定包的路径下用,而不能把q个ClassA.class独立出来使用Q因L话将ClassA.class文g属性中的的包信息不相符。当然当q个ClassA.java没有昑ּ地制定package语句信息时候,我怀疑(也觉得应该)是默认在ClassA.class文g当中包含了包的信息就?."Q可以理解ؓ默认的加入了"package .;"语句?/p>

错误二:
public class ClassA {
  ...
}
~译后这个ClassA.class文g中含有的包的信息?."当前目录包Q?br />把这个ClassA.class文gQ移CClassB.java所在的目录为当前父目录的h为手动徏立的com\cjren\util目录下?br />import com.cjren.util.ClassA;
public class ClassB {
  ... // use ClassA here
}

To compile: javac ClassB.java
错误信息?br />"ClassB.java:某一? 无法讉K com.cjren.swing.ClassA
 错误的类文gQ?.\com\cjren\util\ClassA.class
 cL件包含错误的c: ClassA
 请删除该文g或确保该文g位于正确的类路径子目录中?
想一想ؓ什么出错信息是_“错误的cLӞ .\com\cjren\util\ClassA.classQ类文g包含错误的类Q?ClassA”呢Q因Zq个com.cjren.util包中的ClassA.class文g本来所默认的包信息?."Q在ClassA.java中ƈ没有使用"package"语句指定ClassA应该属于包com\cjren\utilq个信息?/p>

结Q?br />在尝试过E当中发玎ͼ
public class ClassA {
  ...
}
?br />package com.cjren.util;
public class ClassA {
  ...
}
q两个只差了一个package语句的class文g大小有十几到几十k上的区别Q这可能q一步证明了.java文g中的package语句会在.class文g中加入相应的包信息,q个包信息决定了q个class被用时候的方式Q是否需要import特定的包Q?br />q有一点要注意的是Q?br />package com.cjren.util;
public class ClassA {
  ...
}
之后无论是?javac ClassA.java 或?javac -d . ClassA.java~译都不会媄响ClassA.class文g当中所含有的包信息Q这两种~译方式所造成的区别在上面的用说明中已经说过了?/p>


 



cjren 2006-07-06 09:00 发表评论
]]>
2006-06-24build project 自己搭徏的project目录-java-tech-原创http://www.aygfsteel.com/cjren/archive/2006/06/26/55042.htmlcjrencjrenSun, 25 Jun 2006 17:35:00 GMThttp://www.aygfsteel.com/cjren/archive/2006/06/26/55042.htmlhttp://www.aygfsteel.com/cjren/comments/55042.htmlhttp://www.aygfsteel.com/cjren/archive/2006/06/26/55042.html#Feedback0http://www.aygfsteel.com/cjren/comments/commentRss/55042.htmlhttp://www.aygfsteel.com/cjren/services/trackbacks/55042.html 2006-6-24

试以一个例子来说明搭徏一?/span> project 时候的目录构徏情况?/span>

 

情况一

下面以一个地囄辑器的例子ؓ?/font>

project mapeditor

父目录是
”project mapeditor?

.\Image Q?/span> E序使用到的囄?/span>

.\Maps Q?/span> E序q行时用户保存的自定义地图?/span>

.\com Q?/span> ȝ?/span> MapEditor.java 会是用到的 package 的源文g?/span>

.\com\cjren\swing\MyFilter.java

MapEditor.java Q?/span> ȝ序源文gQ代码中没有 ”package?/span> 语句?/span>

runMapEditor.bat Q?/span> 完成~译和运行所需的所有工作?/span>

 

下面主要看看 runMapEditor.bat 的内容:

@echo off

rem output the date and time

date /T

time /T

echo welcome to my map editor :-)

 

rem make the directory for class files

mkdir .\build\classes

 

rem compile the source files

javac -d .\build\classes MapEditor.java

 

rem run the application,

rem but you must avoid this: java.\build\classes\MapEditor,

rem which will be an error

java -cp .\build\classes MapEditor

 

rem clean everything in the build folder

rmdir .\build /S /Q

 

pause

 

从上面的具体代码中可以看出在~译和运行的时候,所有的 class 文g都回被放?/span> .\build\classes q个文g夹中Q这个文件夹是动态生成ƈ且最后会被清楚掉的?/span>

 

q里有三个值得注意的地斏V?/span>

一Q通过 ?javac -d .\build\classes MapEditor.java?/span> Q不单只?/span> MapEditor.java 所定义?/span> class 都被放于 .\build\classes 中,甚至q?/span> .\com ?/span> MyFilter.java 所对应?/span> class 也都?/span> .\build\classes\com\cjren\swing 中,?/span> com 包在 .\bulid\classes 下是自动被准生成的。也是说所有的 .class 文g都被攑֜ .\bulid\classes 文g夹中了?/span>

二,当?/span> ”java -cp .\build\classes MapEditor?/span> 来运行程序的时候,q没有因?/span> Image 文g夹不?/span> .\build\classes 而出错。这说明?/span> .java 文g中的代码已经军_了它所使用到的 Image 文g夹的位置Q这个位|是相对?/span> .java 文g所在的位置来说的,而不?/span> .class ?/span>

三,我尝试了?/span> d 盘下新徏了一?/span> a 目录Q然后把

javac -d .\build\classes MapEditor.java

java -cp .\build\classes MapEditor

换成

javac -d d:\a MapEditor.java

java -cp d:\a MapEditor

之后Q其?/span> ”project mapeditor?/span> 下的所有东襉K没有改变Q程序依然成功执行。这p一步证明了 .java 文g中的代码军_了所有其他目录或文g元素的相对位|,q个位置?/span> .java 文g所在的目录为标准。而与 .class 文g的\径无兟뀂但是:别؜淆了 A.class 它所使用到的包的 .class 的\径是?/span> A.class 文g的\径ؓ标准的!Q!q就与上?/span> MapEditor.class 也和Q必dQ?/span> com 包同处于 bulid\classes 目录下没有矛盾?/span>

 

情况?/span>

目的是把上面情况一中所有的文g和文件夹都包含在 src q个文g夹中Q?/span> src 本n是父目?/span> project mapeditor2 下的一个文件夹。而且我希望编译时候生成的 build 文g夹和 src 文g夹的关系是:

\project mapeditor2\src

\project mapeditor2\build



src
文g夹的内容如下Q?/span>

pj2-src
注意批处理文?/span> runMapEditor.bat ?/span> src 文g夹下Q而且在此情况下, runMapEditor.bat 的内容将有所变化Q?/span>

@echo off

rem output the date and time

date /T

time /T

echo welcome to my map editor :-)

 

rem make the directory for class files

mkdir ..\build\classes

 

rem compile the source files

javac -d ..\build\classes MapEditor.java

 

rem run the application,

rem but you must avoid this: java.\build\classes\MapEditor,

rem which will be an error

java -cp ..\build\classes MapEditor

 

rem clean everything in the build folder

rmdir ..\build /S /Q

 

pause

 

情况一和情况二的差别不大,只是源代码文件多一层的文g夹的包裹。而且最大的共同Ҏ runMapEditor.bat 和源代码文g在同一个文件夹下?/span>

 

情况?/span>

试在情况二的基上把 runMapEditor.bat 提到?/span> src 以及 build 相同的父目录下。假讄目录?/span> project mapeditor3 Q则Q?/span>

pj3
现在
runMapEditor.bat 的内ҎQ?/span>

@echo off

rem output the date and time

date /T

time /T

echo welcome to my map editor :-)

 

rem make the directory for class files

mkdir .\build\classes

 

rem go into the src directory

cd src

 

rem compile the source files

javac -d ..\build\classes MapEditor.java

 

rem run the application,

rem but you must avoid this: java.\build\classes\MapEditor,

rem which will be an error

java -cp ..\build\classes MapEditor

 

rem clean everything in the build folder

rmdir ..\build /S /Q

 

pause

 

在尝试工E当中,发现以下的做法将找不?/span> Image 文g夹:

cd src

javac -d ..\build\classes MapEditor.java

cd ..

java -cp .\build\classes MapEditor

q种修改所造成的区别是q行 ”java?/span> 命o的位|不同了。可以猜x需要在 src 文g夹内q行 java 命oQ?/span> src 文g夹中含有所有程序所需的代码和 image 素材?/span>

 

下面提供一个稍微不同的批处理文Ӟ runMapEditor2.bat Q它也同样处?/span> project mapeditor3 q个父目录下Q?/span>

pj3-

runMapEditor2.bat
的内容如下:

@echo off

mkdir d:\a

cd src

javac -d d:\a MapEditor.java

java -cp d:\a MapEditor

rmdir d:\a /S /Q

pause

q个修改q的例子?/span> class 文g都移到较q的地方 (d:\a) Q但是还可以成功q行。小l一下它能成功运行的特点Q?/span>

一Q?/span> src 文g夹中已经包含了所有的元素Q包括所需的外?/span> package 代码Q包?/span> image 文g夏V这些元素都必须使得ȝ?/span> .java 能成功的~译?/span>

二,q行 ”java?/span> 命o都在 src q个目录下。也是说都在和代码处在相同的文件\径下Q而不是其他Q何\径?/span>

 

情况一都三的小l?/span>

基本满了在 windows pȝ下开发小目的需求,我在q三个尝试的例子中主E序 MapEditor.java 都没有含?/span> ”package main?/span> q类的打包语句?/span>



cjren 2006-06-26 01:35 发表评论
]]>
վ֩ģ壺 | Դ| ֹ| | | | ͺ| | Ӳ| | | | | | ʻ| | ͸| ӽ| | ٽ| | Ԫ| | Ʊ| Ѱ| | | | | ̨ǰ| | | | ղ| | | »| ˷| ˱| | |