Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
NetBeans Reference: - online tutorial == Programming from the command line == ... When you have packages - Let's say the package name is pkg_example. - The .java files must be in a directory called pkg_example - Compile the .java files using javac ____.java - But to run, must go to the parent dir of pkg_example and run: java pkg_example.classname where classname is the class that contains main Asinde: Compiling in Java vs. Python - What are .pyc files? - When a module foo imports a module bar, bar.py is compiled to bytecode, which is saved in a .pyc file. - On subsequent imports bar.pyc is used, unless the modification date of bar.py is more recent. In the latter case, the .pyc is regenerated. - this compilation to bytecode only occurs in conjunction with import statements. - There are also files called .pyo - Same as .pyc, but with line numbers, and other debugging info removed. - .pyo's are slightly smaller than .pyc's - generated with -o flag (to what? XX) == == == == == == == == == == == == == == == == == == == == == == == == == Packages (a Java concept) - a group of related classes - you can set access privileges relative to the packages Like giving your neighbours your key - package names are lowercase Projects (an IDE concept) Creating a project - File -> New Project (or shortcut) - pick a name and let everything else default - pick application (if there will be a main) or class library (if not, you are just defining some useful classes) - Netbeans creates the main class == Running your code == - green arrow - if you have multiple classes with mains, right click on a specific class (in the left pane) to run it == How Netbeans organizes things == - your project can be in any folder - what's in your project's folder src folder - with your code - each package has a folder - each file in that folder holds a class or set of classes build.xml and folder nbproject - files that record facts about your project, such as project name and preferences (compile on save, eg) dist folder - you can compile your whole project into a file for distribution - create, delete, change, open etc through the IDE, not by hand, so it will maintain all of this in consistent, working order == the "main" project or class == - netbeans has one particular project that is in its focus at any one time - that's the one that is operated on by default when you run with green arrow - it calls this the "main project" - similarly, there is a "main class" - don't get confused with this vs "main program" or Java's "public static void main(...) or Python's "main block" The "main project" - in the projects window, right click a project to define it as the main one The "main class" == Viewing the javadoc == - hover over existing code and you see it - hesitate as you type and you see it; choose right one and it inserts the call == Viewing your own javadoc == - right click on project, pick "Gen Javadoc" from dropdowns on side - windows -> other -> javadoc: shows you it nicely formatted hyperlinked so you can click through to related classes, whether yours or part of Java == Debugging == - breakpoint - step into and over - view values == Other features we'll explore over time == - "refactoring" ========= From a student post: This check-style is a NetBeans plugin, if you installed it through NetBeans then by default it's activated, it's not like the python self_check.py program in csc148. To correctly install this plugin, you can download the offline version then extract it and go to "Tools" in NetBeans, select "Plugins" --> "downloaded" and press "Add Plugins" button, then select these two NBM files in your extracted folder: netbeans-checkstyle-library-3.5.5 netbeans-checkstyle-plugin-3.1.0 So it's checking your code the whole time when you're coding. See those annoying underlines ? They say you miss a javadoc comment or something, that's how checkstyle works.