I made a Scala package and a Scala application in Eclipse, but every time I try to run it from Run > Run, Eclipse asks me:
Select a way to run 'example.scala':
- Java Application
- Scala Application
How can I get Eclipse to know that the project or application file should always run as Scala?
Click on the menu item named Window in your Eclipse window.
Select Preferences from the drop-down list.
Once the Preferences window has opened, use the menu at the left to navigate to Run/Debug, then Launching
Under Launch Operation, tick the check box with the following description: Always launch the previously launched application.
Afterwards, Eclipse should ask you only once and remember that choice.
#soc describes a workaround to the problem. At the moment there is no other/better way to make this to work. It needs to be fixed in future.
Luckily, this issue is partially fixed in the current nightly build of the Scala IDE. There is a fix for another problem, that disables the "Run As Java" Option: Disable JavaLaunchableTester on Scala files
It works not for all cases, for example if one right clicks on a package the known "Run As" Options are displayed. But for objects with a main method it works quite well if one uses the "Run As" Option of the Source file.
Related
Every time I right click on a java file to use the run configuration it won't open for that specific file I'm clicking on but the one I previously did. It will do the same for the button on the menu bar at top. I also noticed that it will only allow me to right click and use run configuration on the one I want only until after I run the program and get a run time error. I've tried to restart eclipse but it does the same thing still. So is this a bug on eclipses part or is it a preference option that can be changed?
Currently using Eclipse IDE for Java Developers - 2021-06
This all depends on what object you are right-clicking on, and its characteristics. If Eclipse doesn't see a "main" method, it won't allow running it as a Java Application.
In any case, you've provided very little information here. For instance, we have no idea what "it won't open" means.
I'm writing a python project in Eclipse with the PyDev plug-in, which contains multiple files.
However I'm used to using visual studio, where it'll automatically find the main function of a project and run the program from there.
Eclipse will always run the file I am currently editing (which usually is a file containing function that are called from the main function).
Is it possible to set which file should be run then clicking run? I've looked at the launch options under Project->Properties->PyDev, but didn't find what I was looking for.
When you press the Debug or Run button (Debug on the left) Eclipse tries to intelligently determine what to launch based on your current editor.
You can change the behaviour by editing Window -> Preferences -> Run/Debug -> Launching -> Launch Operation as pictured below.
The default of launching the current editor works well for some languages, but not as well for Python when every single file is itself a valid program to run. In your case I recommend changing to Always launch the previously launched application.
You can create a custom run configuration.
Right click on your project > run as > run configurations
From here is just a matter of choosing your project type on the left hand side and filling in the required information. You can click 'Run' to use your new configuration.
To get to this configuration again, you can click the 'Run' drop down button in the eclipse tool bar and see all of your run configurations.
Hope this helps!
I'm currently working with a multi-platform project, where you have a main common library and several different platform setups (-android, -windows, -mac).
When I click debug while editing a library class, Eclipse asks me for a main class to launch, when it really cannot execute anything. I would like to change the behavior so when I start debugging while in a library class, any of the other projects will be the one launched by default.
As far as I have seen, Eclipse allows multilaunch, command parameters and favorites, but never default to other projects.
Not sure if this is exactly what you want, but you can set Eclipse to always launch the previous launch by default. Go to Preferences -> Run/Debug -> Launching and select "Always launch the previous application".
I've just started using MoreUnit and it seems quite handy. One thing that I am missing however is how to run tests using the debugger right away rather than just plain Run (using ^R).
It's not in the context menu and I have tried a few keyboard shortcut variations to no avail...
Usually in Eclipse, you can just click on the debug button after running the tests normally to debug them (the last run will have created a launch configuration that you can also access from the debug menus).
Other than that, you should find a "Run as MoreUnit test..." in both the "Run" and "Debug" menus (if not, file a feature request).
Lastly, you should be able to open the "Launch Configuration" wizard by selecting "Debug..." and there should be a folder for MoreUnit in the tree on the left. Above the tree is a "+" option to create entries in a folder.
I'm using Eclipse for development because of all the things IntelliJ can't do (e.g. highlight all instances of a variable) and because IntelliJ is dog slow over a remote connection. But because I still don't have Maven integrated completely into Eclipse, I have to switch back to IntelliJ to compile and run my project using Tomcat.
How can I tell IntelliJ to detect all files that have changed on the file system and recompile them? (I don't want to manually open each changed file to get IntelliJ to detect the change.) In Eclipse I would just Refresh the project tree [1]...
Footnotes:
Eclipse has a feature (named "Refresh Using native hooks or polling") which you can enable to automatically detect changes and synchronise the perspective when any underlying changes are detected in the filesystem (see images below). This is quite handy and eliminates the need to manually refresh the project when using build tools - where files/directories get created in the project directory structure.
Is there anything similar for Intellij (explicit setting or otherwise) that eliminates having to click a button to synchronize the view with filesystem changes?
You can use the "synchronize" button (two yellow arrows) or in short Ctrl+Alt+Y
Intellij can highlight variable instances, you just need to enable it .
Further, if you invoke compile project, Intellij will just compile changed files (and hotswap when possible, if you are in debug mode & deploying to e.g. tomcat)
Right click on your Project in the left pane and click on "Synchronize"
You can see the status in the round circling icon at the bottom left of the IDE
I know this question was posted a few years ago, but maybe this info will help someone in the future. I was actually looking into a similar issue, and doing the following worked for me:
Go to Settings > Build, Execution, Deployment > Compiler and make sure "Make project automatically" is checked.
Click File>Synchronize (or) shortcut ctrl+Alt+Y
There is a synchronise button in the tool bar. Click it and it will refresh the project explorer