I have to use eclipse (with ProDT) for running swi-prolog. I installed ProDT via help->install new software, opened the prolog perspective, made a new prolog project and a new file called HelloProlog.pl with the lines I was given:
% helloprolog.pl
hello :- write('Hello Prolog World!').
Then whenever I tried to run the file (by pressing the green play button) I got the message Unable to launch; The selection cannot be launched, and there are no recent launches.
I did check Windows->Preferences->Prolog->Interpreters and added the swipl.exe of the swi-prolog directory, but nothing changed.
I suspect the problem is that there are no Run configurations for Prolog (Prolog is not in that list), but I have now idea how to set those up.
Can anyone tell me what I'm doing wrong?
Perhaps you can try the following (taken from here):
Create or Select a Prolog Process
After opening the Prolog Perspective, create or select a Prolog process in the Prolog Console View .
Select: Click on the first icon in the Prolog Console's toolbar (“Process Switcher”) to see which Prolog processes are currently running. Select one of them.
Create: Click on the second icon in the toolbar (“Create Process”) and enter a name (any string).
The name of the selected or newly created process will appear in the top left corner of the Prolog Console. If the process was newly created, you will see the welcome message displayed below.
Now you can use the Prolog Console to run your Prolog queries.
Related
I am a VS Code fan and recently jumps in programming with Java in VS Code, I've seen some very fancy coding helpful tool with VS Code so I installed "VS Code Java Pack Installer" from Microsoft following this tutorial, in addition I've seen there is a lot of useful code snippet from VS Code such as generating a class constructor, overriding method or code refactor from Microsoft link - Editing Code, most of them are with a context menu option called "Source Action", however, I cannot find such option when right click in my defined class like the document shows, and I don't have context menu such as "Rename Symbol" when right clicking on my java file, am I missing some settings or extensions here?
This was puzzling me as well. I eventually realised what I needed was standard mode rather than lightweight mode. Under the covers, in standard mode, it seems to be running a Java server, which I guess is why it's off by default.
I found the easiest way to enable standard mode was to open a Java unit test, and right click 'run' in the context menu. That will prompt VS Code to offer standard mode. After clicking 'yes' and waiting for the server to be fired up, the Source Action and Refactor menu options are there.
You can see 'Source Action' context menu by following one of the steps.
Click the 'Standard Mode' icon in the status bar. The icon might be available towards bottom-right side of the status bar.
Select 'Run' > 'Add Configuration...'. There you select 'Java'.
In Eclipse Neon after writing a code, when pressing run, output of other code, (previously done) are showing. The output of the code that i have written is not showing. What is the cause off the problem ? Is it related to workspace ?
Just clicking Run runs whatever program you executed last. It does not switch to your new code.
To be sure of executing your new program right click on the class containing your 'main' method and select 'Run As > Java Program' (assuming this is Java as you haven't told us your programming language).
I am using Eclipse Mars to write test applications. Sometimes I need to run two apps at the same time so I open two consoles on my Eclipse. I can change the process being viewed on one of the consoles, but as soon as the other process prints something, it switches both consoles to show that. How can I stick a process to a specific console?
As far as I know you can't assign a process to a console. BUT you can make a process appear on a specific console none the less. To reach that you must click 'Pin Console' for the program you don't want to be changed on startup. Then in the console of the other program uncheck 'Pin Console'. The next program you start will show up in the unpinned console. So you will have to pin and unpin before each start of either one of your programs.
Maybe someone else is interested in the other steps besides the pinning and unpinning:
In the console view uncheck the buttons for
Show console view when standard out changes
and
Show console view when standard error changes
then go to the drop down menu of the console view and click
new console view
then start your first part of the application and assign one of the available consoles to that process and then start the next part and assign that to the other console. You can position both consoles as you are used to with eclipse and watch both of them simultaneously.
I tested this for eclipse luna and neon (so mars (which is in between) should have the same feature).
I've seem to have lost the ability in my Eclipse to auto-correct errors in my source code lines.
For example, a line like this:
Date date = new Date();
has red jagged lines beneath the Date() part. Previously I could mouse hover over it see a popup menu of options to fix it. Now I all I ever get is a popup with the text "Cannot resolve to a type".
The only change I can think of that I've made and I don't know if it has anything to do with this problem, is that I started editing my .java files with an outside editor. Then focusing back into Eclipse I get a popup saying the source has changed and do I want to update so I say OK.
Sometimes I will edit inside Eclipse and sometimes i will edit the source outside of Eclipse. I'm not sure if this is a bad practice or not?
Its your wish to edit Java files outside or inside eclipse. But Java editor has many features which are very helpful to developers. I suggest to edit Java files inside eclipse only.If you find other editors are good or you used to it then no problem you can edit Java files out side eclipse also. The problem you mentioned in not related to it. But make sure that changes are applied before building project in eclipse.
Solution
This occurs whenever there are multiple classes are available with the same name in you build path then eclipse don't know which one to import by default. So keep the caret on the error line and press Ctrl+1. Then a eclipse gives options to user to import one among these. See the picture below. Choose the right one then error will disappear.
I am developing using the PyDev plugin in Eclipse. My program uses several classes in several files. I usually run the program using the green "play" icon or using Control+F11. The only problem is that it will run the file, which is currently in "focus". Usually this is not the one containing the starting point of my application. As I run my program something like 200 times a day, this means that I need 200 extra click on the mouse and often forget about this.
Is there any way of setting the default file to launch?
Yes, change the launching to rerun the last launched, so Ctrl+F11 will launch the last one -- and use F9 to launch the one with focus -- See instructions and details at: http://pydev.org/manual_101_run.html
For me, the shortcut is Ctrl+Shift+F9. I don't think I've changed any keybindings, so its strange that it would be different from the official documentation.
Go to Run->Run History, and select the run that is your 'main' run. Now you should be able to use Ctrl-Shift+F9 from any other file to rerun your main. If it isn't Ctrl+Shift+F9 for you, look on the console window that should be at the bottom of your screen showing the stdout after every run. There is an icon on the top of it that has the green start arrow with a yellow arrow underneath it pointing to the right. That is the command to relaunch with the same configuration. If you hover over that, it should tell you the keyboard shortcut you need.