There are two different ways to clear the terminal in BlueJ. You can get BlueJ to automatically clear the terminal before every interactive method call. To do this, activate the 'Clear screen at method call' option in the 'Options' menu of the terminal. You can also clear the terminal programmatically from within your program. Printing a formfeed character (unicode 000C) clears the BlueJ terminal, for example: System.out.print(' u000C'); This will work in the BlueJ terminal, but is not guaranteed to have the same effect in all terminals. How do I use custom class libraries (JARs)?
Sometimes, you may want to make your own libraries generally available in the same style as the Java standard libraries. For example, you may have your own package called 'simpleIO' that you want to use. Then you may want to be able to write import simpleIO.*; without the need to copy all the simpleIO classes into every project. There are actually three ways of doing this in BlueJ.
![How To Run Files Using Cmd How To Run Files Using Cmd](https://icsejava.files.wordpress.com/2009/12/x14.jpg?w=512&h=273)
How run a java program without bluej. He will run the file alright. To create an executable jar file in BlueJ, open a project, File -> Create Jar. If this does not work, you can try to clear your temporary files ('%temp%') folder, then run the BlueJ launcher MSI again. I suggest you make the effort to do the BlueJ Tutorial.
The first way is via the 'Preferences' dialog. Open the 'Preferences' dialogue and select the 'Libraries' tab. Then add the location where your classes are as a library path. Restart BlueJ - done. The selected libraries will now be available in all projects that you open. One small thing to look out for: if the classes are in a jar file, select the jar file itself as the library. If your classes are in a named package directory structure (for example in a directory named 'simpleIO'), choose the directory that contains simpleIO (not the simpleIO directory itself) as the library!
The second way is via the 'userlib' directory, found at /lib/userlib (that is, inside the 'lib' folder which is itself found inside the folder in which BlueJ was installed). Any libraries placed in this directory will be loaded by BlueJ. This is intended to be a 'system wide' method to use custom class libraries as it will apply to all users using the same installed copy of BlueJ, so it can be used for instance in a lab environment to make the libraries available to all students. These libraries must be.zip or.jar archives. Naturally, to put a library in a 'userlib' directory, a person must have write access to the directory.
Libraries loaded via this second method are listed in the 'Libraries' tab of the 'Preferences' dialog also, but libraries cannot be added to or removed from the userlib directory via the dialog. These libraries will be available in all projects. The third way is via the '+libs' directory. If a directory called '+libs' is found inside a project when it is opened by BlueJ, then all the class libraries inside it will be on the classpath (and therefore available for use in the project). This is a convenient way to allow libraries to be loaded on a project-by-project basis. This comes in handy if you want to distribute a project with any libraries that might be needed for it to function.
You can simply zip up the project directory and distribute the project. So in summary there are three ways that custom class libraries can be made available inside BlueJ.
For system level access (all users and all projects) you can use the 'userlib' directory. For user level access (all projects for a single user) you can use the Preferences Dialogue to add a library, and for accessibility from a single project you can create or add an archive to a project's '+libs' directory. How do I use objects from the standard library classes? It can be very useful for educational or testing purposes to instantiate library classes.
For example: Do you want to play around with a String object? Do you want to see how java.awt.Point behaves?
In BlueJ, you can do this. Select 'Use Library Class.' From the tools menu. Then type in (or select from the popup menu) the full class name of the class you want to instantiate.
Hit enter, and you will see a list of all constructors and static methods. Select one - and you're done!
You can, in the same way, call static methods of library classes. For example, select java.lang.Math, double-click the 'random()' method and - voila - you got a random number! How do I use JavaFX in BlueJ? BlueJ 4.0.0 and later versions have support for running JavaFX applications. If you have a subclass of JavaFX's Application class, you can right-click on it and select 'Run as JavaFX application'. Since version 4.1.1, BlueJ will also prompt you to ask if you always want to run this project's code on the JavaFX thread, which is required if you want to interactively invoke code that manipulates the JavaFX GUI. If you want to run JavaFX code without writing your own Application subclass (or you are using BlueJ 3), you must initialise JavaFX in your code (e.g.