Compiling and Running Files with JCreator

Compiling

Compiling with JCreator is very simple. Once you create a class, or a project, simply click on the compile class, or compile project (depending on which you created) button on the toolbar. If you created a lone class without a project, the .class file will be created in the same directory as the .java file. If you created a project, then you will notice that in the directory where the project is saved there are 2 folders, src and classes. The src directory holds all the .java files you create within JCreator, and the classes directory contains, what else, but the class files.

Arguments Prompt

To specify the command line arguments when you execute a program from JCreator, you must enable this setting. Goto Build -> Runtime Configuration. Then click on default -> edit. In the next dialog box select default -> edit again, and finally select the option for "Prompt for main method arguments".

When we grade projects we will run the programs from the command line; this feature emulates this and prevents you from having to constantly use the command line every time you want to run the program. As shown in the image below, when the run button is pushed, a dialog will appear asking for the args. Input them as if you were using the command line and hit ok. Just keep in mind that when you run a java progam from within JCreator, the 'local' directory is the directory where the .class files are. So if you try to load "input.txt" from one of your programs, its going to look for that file in the class directory. It never hurts to run your program once from the command line when you are done to be sure it will work when we grade it.

Now you know the basics of using JCreator. Enjoy!