JCreator Use Tips

Source: Internet
Author: User
Tags documentation
JCreator Use Tips-1



Lead:

In many Java development environment, I have a special feeling for jcreator, I can not say why, probably because the first tool I contacted is it. A lot of people today may be dismissive of it, because there are so many Java development tools, and the names are much louder than JC, like Jbuilder,eclipse,intelj, they are rich in functionality and very convenient to use. But do not forget, the function of the powerful and occupy the resources are proportional to, and I like those who are not high configuration of the brothers, the use of it is not necessarily more convenient. By contrast, JCreator is much more comfortable.
As the saying goes, though small, spite, as a bit of a history of development tools, JCreator has designed a considerable number of functions. I have not touched it for a long time, but also for some time, and for its function, some experience, there are some doubts. In the next few articles, I will write out these, I hope that some of the brothers to use it to help, but also hope for my doubts, can have a master to help me dispel doubts. :-)

Not many pictures, are expressed in words, if there is no place to speak clearly, please leave a message, hehe ~~~~~
No more nonsense, get to the point. In this article, the JCreator version used is v3.1.


--------------------------------------------------------------------------------

Installation:

It is necessary to install the JDK before installing JCreator, and it is also a good idea to download Javadoc to the local computer.
The final step of the installation will have this screen, divided into three steps, "file association", select the JDK and Javadoc directory options.

In this piece of file association, you can remove the type of file you do not want to associate with JCreator, which is really difficult to choose. Because another development tool I use is eclipse, which is quite uncomfortable when editing XML documents with Eclipse, because when it edits XML, the two parts of each element are edited manually and not generated automatically, but JCreator can help you generate the latter part of the code. But when Eclipse creates a new document, it opens a default file editor (except for. Java), so every time you build an XML, it jumps out of a jcreator:-(. Every bit difficult, so the choice of this option entirely on their own personal interests, there is no need to refer to whose methods. Click "Next".
Go to the "JDK Home" option, if the computer has installed the JDK correctly, JCreator will find the installation directory on its own, but you will find that its hint is still ": (", this should be the representative directory selection does not mean success, but as long as you think the above path is no problem, Then please do not ignore it, it makes a fool of. Then click on "Next".
Javadoc is a document that every JAVA developer should be equipped with, and many of my classmates have made mistakes in choosing this directory. They chose the root directory as the docs, the root of Javadoc, docs in addition to the API, "Guide...images...relnotes...tooldocs" and a index.html file, The API directory that should actually be selected. This allows you to view the JAVA document directly in JCreator.

Finally, you can click "Finish", installed to this has been done.


--------------------------------------------------------------------------------

Change:

This part of the talk is that JCreator has been installed, but the JDK has been upgraded, or the directory of Javadoc has changed, and if I want to then let JCreator play its power, I have to reinstall it. The answer is obviously negative, if the answer is yes, it can only be said that the tool is rubbish.
The steps to change the directory using the JCreator in are this. Click on the menu: Configure-> Options-> JDK Profiles. If the previously specified directory no longer exists, JCreator will not be able to prompt the JDK in red font, you can choose Delete to remove it from the new directory, or click Edit to change the directory. When "edit" is selected, the dialog box that jumps out has three card, "Classes...sources...documentation", which can also be used to reassign the JDK directory.
"Sources" This election seems to be the same, I still do not know how to use the "Sources" to view the original code, as if only a blind point to Debug when it jumped out, but still do not know how to use, please enlighten me.
The "Documentation" selection method is the same as the previous one, with the "API" as the root directory.


--------------------------------------------------------------------------------

Classpath:

Java beginners, including the first contact with Java C + + colleagues, most of classpath this thing feel a little headache, what thing ah. After learning JAVA for some time, I saw people on the forum say to add Xx.jar to Classpath, still feel some confusion, increase. How to increase. But now I finally understand. Classpath is extremely important in Java, where the JVM is generally looking for resources in classpath. And in the jcreator of a certain. The way the jar file is added to the classpath is pretty straightforward.
The above dialog box, with an "ADD" button on the right side of the classes, provides a way to add some files to the classpath by adding. jar and adding catalogs. You can also change the priority of a directory so that the JVM looks up the class you want to import from the top down.
Another way to do this is to right-click the project name on the left side of the JCreator after you create a new project, and the bottom option is "Properties," where you can change some settings, such as the output directory of your *.class file, and the other rightmost one. Required Libraries ", added in this place. Jars or directories will be placed directly on the classpath level. Rather than on the top of the cumbersome choice, move up and down.

========================================================

First, the establishment of empty projects for Java programming

It's best to build an empty project first when you're programming. Then, in this empty project, edit your Java program; This is a good habit, you can build your own package in this project, you edit the source program, according to the different functions of different packages So after you've been learning Java for a long time, you have a bag of your own, which is convenient for you to learn or check the relevant code later.

The way to build an empty project may be known, but here's a little wordy:
In the order of the Jcretor menu, create the method as follows:
File?? >new?? >project?? >EmptyProject;

Second, Jcretor to the JDK's help document provides a good support

With Jcretor you can easily access the JDK help documentation instantly. This feature enables Web pages to be displayed directly in the JCreator editing window without having to open any other browser for browsing. (JCreator This feature I like very much, as far as I know Eclipse does not provide this function) below to see how to use this feature.

Do not know if you remember after we loaded JCreator, the first time you run JCreator, the system will require you to specify the installation path JDK; in fact, if you remember, after setting the JDK installation path, you will also be asked to provide a docs path. That's it...... Let's take a look at how to set this path:

First, download the corresponding JDK documentation from the Sun company website;

Second, create a folder named Docs in the JDK installation directory (for example, my installation directory is D:\j2sdk1.4.2_06), and then extract the downloaded JDK document into the folder that you just created, and after the decompression is complete, Then, when installing Jcretors, select the directory where the JDK documentation is located at the appropriate place; (Note that you should ensure that you do not have Docs folders under the Docs folder)

When set to start JCreator, whether you will find any changes in your jcreator. In fact, please look at the Help Pull-down menu in the JCreator menu bar to see if there is something more. There is a "JDK help Ctrl+f1" menu item. If so, the configuration is successful. Below I will show you how to use this function;

Again, use Jcretor to play the role of the JDK help document.

When you write a program in JCreator or look at someone else's original code, you will definitely encounter unfamiliar or unknown classes or methods, this time with the mouse to select the name of the class or method to query, and then click the Jcretor menu bar in the Help menu below the JDK Help, At this time will find the information to be queried immediately in the form of a Web page jcreator. Quite simply, it can be compared to a CHM-formatted JDK document.

Third, the Web page file directly in the JCreator edit window display
This technique seems to be a bit similar to the second, Bandi is to implement the Web page file directly in the JCreator editing window, and eliminates the hassle of opening another browser tool. In fact, this function is mainly to facilitate the writing of Java Applets applet programmer. When you write a applet program, you always have to use the Web page to observe the results of the program, then write an HTML original file with Jcretor and save. You will find the filename in the File View window at the far left of the JCreator edit window, select the file, right-click and click the View in Browser menu item, and soon the selected HTML file will appear in Jcretor. This method is more convenient than using a browser to open this HTML file.

=======================================================

Configuration of USER commands in JCreator Pro 2.50:

The command to create a running jar file is configured as follows:

Where RUN.MF is the manifest file
Abc.jar is the output file
* is all files in the current directory

Configuration of the Create Jar file command:

(1)
Command:c:\jdk1.3\bin\jar.exe
ARGUMENTS:CVFM Aaa.jar RUN.MF *
Initial: $[filedir]
The generated file is under the current file directory [Filedir].

(2)
Command:c:\jdk1.3\bin\jar.exe
ARGUMENTS:CVFM $[filedir].jar RUN.MF *
Initial: $[filedir]
If you change the arguments, you generate a. jar file with the name of the directory that contains the current file.
And the file is in the same directory as the current file [Filedir].


************************************************************************
************************************************************************
Command://Order
Arguments://Parameters
Initial://Output Directory


1. To create a running jar file (RUN.MF)
Command:c:\jdk1.3\bin\jar.exe
ARGUMENTS:CVFM $[filedir].jar RUN.MF *
Initial: $[filedir]

2. Package into jar file (not run)
Command:c:\jdk1.3\bin\jar.exe
ARGUMENTS:CVF $[filedir].jar *
Initial: $[filedir]

3. Compile source program
Command:c:\jdk1.3\bin\javac.exe
Arguments: $[filename]
Initial: $[filedir]

4. Run application Program
Command:c:\jdk1.3\bin\java.exe
Arguments: $[filebase]
Initial: $[filedir]

===============================================

Workspace/project/file:

I don't know what to say here. Really want to jump over. Because there's nothing to say about creating work areas, projects, and new files.
Or the last Classpath of the problem to say more carefully. JCreator You cannot configure separate classpath,eclipse for each project as Eclipse does for each project with a. classpath file Save settings, but JC can't, I looked it up in the engineering directory today, and I didn't find it. A description of the classpath.

Javadocs:

Write the program is unavoidable to query something, in the JCreator JDK docs method is to press "CTRL+F1" and then search, I believe that everyone is very clear. But I don't know how many people have tried another method. For example, I want to query Java.lang.System documents, that can be OK: in the process of writing a program to select the word system, and then press "CTRL+F1", and then hands together, pray JC do not jump out of that dialog box directly to help you bring up the system document, I am particularly fond of using this method to view documents.
The last time I introduced this feature to someone else's blog, the author said that it was a good feature, and that Eclipse didn't have the function, and that's the right thing to say. But why Eclipse does not have this function is also because they do better, move the mouse over and press "F2", not only can see Javadoc, his own method can also look at the annotation, but JC can not see their own written class/method of the marked document, or I have not put the environment configured well.

Add comments for your:

It's a good practice to write comments for a program, and JAVA's two types of annotation jcreator are supported. The increase of ordinary annotation nothing to say, here is to add Javadoc for the program: "/** * *".
This is the annotation I added: First in the method/class/data to be annotated on the top of the "/**/", and then press the direction of the key "←", and then "enter", and then there is a kind of comfortable to say. (And as far as I know, Eclipse doesn't seem to be doing this yet, but perhaps it has a better way, which eldest brother know the words trouble to say OH) of course, this method is when you have more than a line of comments to do so, if the annotation is only one line of words or to their own "/** * *" knock on.

Quick Write program _1:

This short paragraph is about how to get JCreator to automatically help you add some non-technical stuff to a little bit of skill, here I have some do not understand the place, perhaps, mutual communication for each other's progress will be faster, where I do not know and you know, just say.
After a new project is created, it is not known how to increase the number of new classes. If you are using the selection menu of the File-> New->file, then it means that your method (①) is not good enough, hehe, and listen to me slowly.
In general, we will create a few more directories under the Engineering directory to organize the program into package, for example, I like to create a new folder "CN", under it to build "Liltos", and finally in the "Liltos" below to build some easy to remember the folder, such as writing a reflection of the program to build a called " Reflect "folder, organized like this into a tree-shaped structure. If you use method ① to create a new JAVA program, it is not always to reposition the program.
And my approach is, click on the project directory under the "SRC" right button, Add-> new folder to create new folders, each folder is a subclass of this, and a new JAVA program, it is ADD-> new Class, of course, is in your sub-folder under Surface. Look out of the dialog box, Location has been to help you write well. And the package one to help you get it done. There are superclass and modifiers and some methods that can be done together.
Look at the items on the left, respectively, "Class settings ..." Implement interfaces ... Add method ... ADD members ", in selecting the interface to implement, press Ctrl to select multiple interfaces. When adding member methods and member data, when you enter the name, type, and so on, each additional member, you click on the "Add" button on the right, the choice of method also has the modifier choice.

Here's one of my questions:
The addition of a method, the comments in the program, a lot of empty lines, personal feelings affect the visual, because I personally prefer the compact annotation style, so every time is manually deleted, I do not know where to set up to let it remove the blank line.

Add a new experiment: Create two classes under the same folder, and reference each other, i.e.
Class A {b b;}
Class B {a A;}
In this case, you can compile two programs separately, there is a way to compile the entire project, but this is obviously not a good way, a relatively good way is, in the left file view where the right click on the two programs in the folder, and then compile folder. So, smoothly through compiling.

Quick Write program _2:

For each attribute of the Get/set method of writing is very boring, the most annoying is to write such things, a little technical content is not. As a relatively sophisticated development tool, how could this not be supported?
When you finish writing fields, you can do this in this way. Tools-> Insert Bean Methods. The above is a class that you choose to insert, and the following is a selection of the methods you need to insert, in addition to the get and set mentioned above, as well as some other methods, including: ToString, constructor, Copy constructor, and one I don't know what to use. Insert into clipboard, put in the Clipboard what ah. Options include: Insert method as single, Group Set and get Methods, and exceptions, the exception is really not necessary, if there are exceptions, then the program can not be written.
Here's one thing I've written before, the ToString () method generated with JCreator is more interesting, you can try ^_^
And in other options in the Tools menu, there are "character encoding...implement Interfaces...file splitter...version control", the first and last I have never used, It is estimated that they will not be contacted until after work. There is no use in nature to say.

Here I also have a question:
I remember before I added Get/set method, it will automatically help me to write the method body, but now is not, the method of production is abstract method, which master can be generous enlighten you.

===============================================

In Java, it should be said that most of the program, there are always some fixed combination, the most common in Java is Try{}catch (Exception e) {}. Because I was learning a long time after the C language in depth to learn JAVA, so there is a little unaccustomed to it, the beginning of the time always forget to write, compile the error at the back of the method in the throws Exception, but this is not a good habit as if. Remember to write a try and sometimes forget to write catch, and finally a chance to discover the following to say this function.
When you want to write a try, click the key combination: "Ctrl+e", you can see the jump out of a dongdong, is what to do with it. Try to know it, hehe. It includes automatic generation of some of the following modules: "Javadoc comment...while loop with block ... System.out.println ... A lot of ah, all listed to affect the visual. Such a good thing I really do not dare to write more things, afraid of writing is not good, write bad will let me feel very guilty, or to be able to see this article comrade himself to feel it.
Personal feeling, this function, is the most jcreator provided by many of the most cool, since the discovery of this thing, I like it more and more. The taste of this can only be realized after understanding it.
Say is not how dare to write, but there are some things I should mention. If you don't like the format of some of the Code it generates (which is normal, I don't like it not to put ' {' on a single line), you can make changes. The method is: Select Configure-> options-> Code Template in the menu. In the penultimate row of the list on the left.
The right is divided into two pieces, when you select a "Label" above, you can set up in the area below. For example now choose "Forb", the following content should be:
for (int i = 0; i<|; i++) {
}
You can change the i++ to ++i, take ' {' another line, and here's the symbol ' | ', is you edit the program when the mouse after the selection of the location, of course, you can also define their own. When you think you are satisfied, click "Apply" below and the JCreator will add this one. Oh, I forgot to say that I can add my own purpose. There's an "Add" in the middle, isn't it? Click on it to let you fill in Label & Description, follow its example, fill it out and then select it for editing.
This is the point of writing here.

shortcut key _1:

Write C with TC come over brother must often press these several keys: F9, Ctrl+f9, Alt+f5. Compile, run, and view the results, respectively. Don't say much.
This shortcut key is very convenient, isn't it. I always don't like to move the mouse when I knock on the keyboard. But jcreator default shortcut key, only in for each Applet to build a project when press F7, F5 more cool, for the compile/Run application seems to have no default shortcut keys, this in Let me use v3.5 more and more uncomfortable, I think there must be somewhere to Set. The time is not negative, finally, find it.
Select the Configure-> Customize-> Keyboard in the menu. To get a new "compile a single program" shortcut, click in this order: select "Build" in "Category", then select "Compile file" in "Commands" and move the cursor to the text box under press New shortcut , and then press the key you want to press, click on the right side of the "Assign", of course, JCreator will ensure that you currently press the key combination in the system is the only one, there is conflict it will report, so, confidently increase it.
For other commands, you can increase your habits as you like. For people like me like nostalgia, I put "compile" and "run" the combination of the set into "Ctrl+f9" and "Alt+f5", hehe, is also regarded as a miss of TC.
In addition, the JCreator other shortcuts can be found in the "JCreator Help" Using the Editor-> "keyboard shourcuts", and all the words are too tired to die.

shortcut key _2:

Think most people are in the Windows environment in the process of writing, that should have a certain understanding of Windows shortcut keys, and commonly used shortcut keys should be skilled use. For example, "Undo ... Copy ... "And so on the basis of the absolutely needless to say."
But the combination doesn't know how many people are using it. "Ctrl+tab ...." Ctrl+f4 ". is "Ctrl" rather than "Alt".
They work a bit like this, with "Alt" used for window switching and shutdown in the Windows taskbar, and "Ctrl" for switching and closing small windows within a process. Like NetScape and Tencent Brower, of course, JCreator can do the same. However, if you just want to keep only one small window in the editing window and all the other windows are closed, use your mouse to make it more comfortable, especially if you are more open.
OK, here's not much to say.

my question:

It's called "all the said, Liker", so far, finally put my current thinking of the various low-level advanced skills all finished, then I should ask some questions, if you want to pinpoint the nature of the problem, it may not be about the development tool, but on the JAVA itself some of the problems.
①, in many development tools have such a thing: Toggle breakpoint. What is this for?
②, there are also Debugger. Only know when Debugger, encounter breakpoint will stop, do what. How to keep it going.
(Ps @ 5.16) Try again today, in Debugger mode, the program will perform to breakpoint stop after the "build" in the "continue" will continue to execute, but if the breakpoint did not print out the intermediate results, how to know the The change of the image value. And how to find bugs.
③, often using e.printstacktrace () when throwing an exception; Says it's a tracking stack, but how about a tracking method? Is there a feature in the JCreator that looks at the data in the program stack? Some words are where. If not, what is the use of this statement? What else do you want it to do.
I faint, how usually encountered so many problems, but now can not think of it.  -_-!!  ̄_ ̄!! Then ask these first.

the last of some nonsense:

A mature tool, or something else, will provide a fairly complete help document, like the JAVA language api_docs,windows Help Document ... These documents are written by developers and should be authoritative, and in theory, the various problems encountered with the tool can be found in the answer. So, take a good look at the use of tools from the documentation to solve the problem is a programmer's basic business quality. My three articles down, also has a good thousands of words (including some nonsense), but when I put the jcreator of the menu again after careful look, found there are some good details of the place did not mention, but after thinking, or decided not to write, to use its friends to explore their own

Go from: http://sunshinechen2008.blog.163.com/blog/static/107585374201022310192343/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.