I wrote some java code in eclipse - this code reads files that are in src/main/resources/input and it writes files to src/main/resources/output. When I run locally (or debug), this code works exactly as I expect - the files open successfully, I can read the data I need, and I can write the data I need to write. Then I copied the code into a new project with VS Code (I want to start using VS Code instead of eclipse). I have the project set up as needed, including all the typical plugins for java development, but when I debug the code in VSCode, it fails to find the input file (FileNotFoundException). Same code, same file location, same file name.
The same behavior happens when trying to write to the files - Eclipse works fine, VSCode gets a FileNotFoundException.
Is there something I need to do in VSCode so that it can find the files?
Thank you for any help you can provide.
SRJ
Related
I have a legacy code base which has CMake configuration and .sh files which calls build commands with respect to build type ( release, relwithdebinfo etc.) as well as does a lot of things.
I have to work over codebase. So far I used STM32CubeIDe. I imported the project as existing Makefile project and then I changed C/C++ Build directory to where makefile outputs converted.
So whenever I did a change on the code, I hit the build command over UI and it calls make command at where I modifed the path above.
This is working but In case of a need of debug then I had to use .elf outputs and OZONE J link Debug program.
I have to do build+debug in same environment but eclipse is slow and making me struggle.
How can I make VSCode host to my legacy code in order to build and debug and also navigate in code i.e go to the definition of code in VSCode, not only building.
Please navigate me if anything needs to share from existing code base, if there is still unclear.
I have been using Atom for a long time, at the end it has been just for comfort but for the last few weeks I have been using VS Code, and I am delighted with the IDE, so I want to completely migrate to it.
But the only thing I'm missing from VS Code is the functionality that Atom Editor has with the ftp (ftp-edit extension) plugin that allows me to navigate through the ftp directory without previously downloading the files, just when I open files or directories in IDE perse. Instead the extension ftp-simple of VS Code doesn't allow me to use this functionality (or at least I haven't know how to find it) so I have to download the entire ftp tree, and on each connection I have to wait as long as it takes to get off.
Any idea about this configuration or if this is any parameter in some config file?
I know about the other stacks but I didn't recive any answer for this.
Cheers!
I've been writing a .cpp file for two entire days now. It was just that one file, for an university project. So, I finally finished the code, and I decided to see if I could make a C interface to use it in C (generating the .o files with g++ and then linking them together to use with gcc). So I executed a g++ command which removed the .cpp!! (Cool, ahn?!)
It was opened in the VS Code, but the editor closed the file as soon as it was deleted (omg why?! worst design decision ever but whatever). Is there any way to recover the file? It's not in the recycle bin.
I was recently using VS Code server (i.e., SSH into remote machine) when I "Permanently Deleted" the wrong file. I was able to find it in /home/{username}/.vscode-server/data/User/History under the temporary files & folders by looking at the most recently used items. Hope this helps someone else!
I'm trying to pass a .txt file as a paramater into my java program.
My program is titled SetTest and the file I'm trying to read is Ted.txt. From a Windows 7 command prompt I create a temp folder and compile my program there creating SetTest.class. Also in that folder is Ted.txt. From that temp directory I then issue the command:
java SetTest < Ted.txt
Everything works as expected. The program reads in the file and outputs what I'm looking for. All good.
My question is how do I duplicate this using Eclipse? I believe my text file is in the proper location, listed under JRE System Library as seen in the Package Explorer. I've been trying the following from Eclipse: Run -> Run Configurations... Then in the (x)= Arguments section, in the Program arguments field I enter Ted.txt then click on Run. Unfortunately nothing seems to happen. No error message, but I don't see the console output I'm looking for either.
To rephrase your question - you want to send a file to your application's standard input, while it is running in Eclipse.
You can write (copy & paste) data into console (that's where the standard input is taken from). However I am not aware of any possibility how you can redirect file contents directly to the standard input.
UPDATE with correct keywords you might be able to find more resources:
Eclipse reading stdin (System.in) from a file
https://bugs.eclipse.org/bugs/show_bug.cgi?id=155411
I set up unit testing in Zend Studio last week, and it was working fine.. until suddenly after some refactoring, I got an error that the following file was not found in ZendPHPUnit.php:
/var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.2428213892936827201.php
The file path is stored in $_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] in ZendPHPUnit.php
I checked the folder and I found
zend.phpunit.UserrMapperTest.php.6031927106542896607.php (the number is different)
I was a little desperate so I made it work by forcing
$_SERVER['ZEND_PHPUNIT_TESTS_LOCATION'] = '/var/folders/Td/Tdnh++2KEdWAsk8Y0O4N0k+++TI/-Tmp-/zend.phpunit.UserMapperTest.php.6031927106542896607.php';
Eventually, after I worked with a few other test cases, the problem fixed itself. Now, I refactored some code again, and the problem is back. None of my testcases work.
Restarting the comp doesnt help, Project -> Clean doesnt help. I am on a mac running Snow Leopard.
Any insights on what is causing this?
Thanks!
The problem is that PHPUnit doesn't work with the files themselves but with copies of the files that it creates on the fly and stores on directories that are also created on the fly. These files are modified to include PHPUnit logic. This goes for the test files themselves as well as for the php.ini (which forces you to load extensions in the main php.ini file for the tests, since additional .ini files are ignored). Every time you run the tests these files will be re-created with a new unique name (original name plus unique identifier).
The best way that I've found to work around this issue is to create launch configurations for the tests and save them as .launch files in your project (right click -> run as -> create new PHPUnit config -> select "shared file" in the common tab). Once you have the launch configs you can just run this by opening on the editor and clicking the Run button. You will see that after every time you run them there will be a line like the following on each launch file that has changed (easy to see if the configs are in version control):
<mapEntry key="ZEND_PHPUNIT_TESTS_LOCATION" value="/var/folders/my/ph9spb0s45z5_11l9tqw256r0000gn/T/DefaultWorkspace.phpunit.AssignmentRequestControllerDateCriteriaTest.php.4951739174960507380.php"/>
I usually just commit this change together with whatever other changes I've been working on at that time.
It's still kind of annoying that the file changes and thus the launch config, but at least in this way your tests will always run and you don't have to worry about having to re-run the manually, or clean the project, or anything like that.