This problem is really becoming frustrating for me. I have this plugin which has a command, which works perfectly during runtime. When I click on the command during runtime, it does what it is expected to do (create a .cfg file from a .c file). After installation, I am encountering two issues:
The handler does not fire after I click on the command.
Nothing is printed on the console. I have another plugin whose handlers do what is expected of them after installation, but they fail to print any output to the console.
Where am I going wrong? Could someone please help?
Thank you.
Note: When I click on the command, the control actually goes into the handler class. It is just that it does nothing.
The Eclipse console shows the output of programs you are testing, it does not show the output of any plugins installed in Eclipse.
The output of things like System.out.print are discarded unless Eclipse is started with the -consoleLog option (and even then the output is not put in the console).
A plugin can use the various console APIs to create a console for output or to access an existing console.
Related
I am running a Java project based on a maven/pom.xml project. I recently made changes to the code, and am finding that if I run the project using IntelliJ's 'Run' command, the code works as expected, but if I run it using a ./mvnw command I'm seeing different behavior.
The main thing I want to know is exactly what commands are being executed by IntelliJ's run command, so that I can hope to understand exactly what is different. If there is a way to flip a flag in IntelliJ so that it will list exactly the command(s) it is executing, all the better.
As a final detail, here's the 'Run' button:
It turns out that the command is indeed shown in the output, but it is truncated unless you hover over it. This was unintuitive, and I only noticed when attempting to respond to the comment from #y.bedrov.
Specifically, here's the initial output I see when I 'Run':
If I click on that first line, it expands to the full command that is being run:
I start coding java with VScode recently. I have a simple problem. The problem is that I do not want the output to be like that. In other words, I do not want the program to run in the terminal as shown below. I just want the statements to be printed alone. Here, I just want (Hello world) only to be printed with nothing else. I googled how to run a java program and I found that the output must appear in either OUTPUT or DEBUG CONSOLE.
Can anyone please help me?. NOTE: I installed java 14 as well as all needed extensions in VScode for java.
If your code needn't input data, you can add this in the launch.json:
"console": "internalConsole"
The default value is:
"console": "integratedTerminal"
I do not suggest install the 'Code-Runner' extension, because it will compile the java file under the same folder of the java file, and mix them up.
And I recommended you to get used to the outputs, the outputs can provide useful information, let you know what's exactly the vscode does. If you run into some problems, you will need this information to help you to solve the problem.
In this case, you can just press Command F5 (Mac) or other keybindings (https://code.visualstudio.com/docs/getstarted/keybindings). This runs the program in your IDE. Otherwise, you can create a launch.json file to configure your debugging.
What you want to do is follow the instruction in Run and Debug Java in VS Code to setup a launch.json file. This defines how your code is launched and where the output from that debug session goes. You can customize the Debug output that appears by adding and configuring the User Settings for the Microsoft Java Debugger
Here are some things which you can do:
If you have installed all necessary extension packs, then the editor would display an option to Run & Debug the class on the code itself. (rare cases but it appeared while working in Linux)
Else type javac <name.java> in the terminal(output will be displayed in Terminal tab)
Or install the code runner extension which is available in VS Code Marketplace (that would display results in output tab easily)
There are no problems with the lines of code, but what is bothering me would be this pile of information that appears in the Output window. I would like to see only the result of the code, written as I marked it in red:
You are freely choosing to write to the Output window in NetBeans, where other NetBeans processes also write their output, so arguably what you want to achieve is not reasonable or prudent, and there is some output in that window which you probably cannot suppress anyway.
That said, a simple change which may help a lot is to suppress all Maven output except error messages by adding the --quiet setting:
Tools > Options > Java > and click the Maven tab
Select Execution from the Categories tab, and enter --quiet in the Global Execution Options field.
Click Apply and OK.
That should get rid of most of the Maven output in the Output window, but note that:
Other NetBeans processes may will still write to it.
That --quiet setting is global, and will apply to all Maven projects you run within NetBeans.
An alternative approach is to direct all Maven output to a file using --log-file {filename} in the Global Execution Options field. You can couple this with the --quiet setting. For example: --log-file d:\temp\mvn1.txt --quiet which will create a file named mvn1.txt which only contains your output.
Yet another possible approach is to direct your application's output to a file independently of Maven. See this answer for how to do that for simple PrintStream ouput.
so, I accidentally chose "don't show me this message again" and "Run anyways". is there a way to undo this setting? Like there can be typos throughout the program, and it'll still try to run. I don't want this, because if there's a section of code that might not be called while i'm testing the program, I might not notice the error.
newest version, 7.4 NetBeans EE for windows
if a function call is actually made to the "uncompilable source code", then it gives such an error
I can search through the program manually line by line, making sure there are no red squiggly lines, but this seems impractical. perhaps I should just re-install netbeans?
According to multiple posts on the Internet, you should remove the BuildArtifactMapperImpl.properties file in the <netbeans home>/<version>/config/Preferences/org/netbeans/modules/java/source/ directory (where it is depends on your installation).
It should have the askBeforeRunWithErrors property set to false. Some just fixed buy deleting the whole file.
Personally, I do not have that file but I have not checked that option, so it might be generated at that point.
how about you delete the settings file stored in the your user DIR as an xml file. it will reset netbeans bac to defaults. or you can edit it and locate parameter askBeforeRunWithErrors to false as it's set to true.
There is a red stop button in the output window. Click that.
There is a bug in NB forum. And another forum reply says that
Don't bother - found it after making a directory diff :
Simply remove the file
.netbeans/7.0/config/Preferences/org/netbeans/modules/java/source/BuildArtifactMapperImpl.properties
I'm in the process of porting simple console apps written in C++ to Java in order to show how similar the languages are, and how code can be ported. I've exported executable JARs for the programs using Eclipse. These JARs work fine when they are run using the java -jar command. However, they do not run properly when executed from windows explorer (double clicked). A console window simply opens and closes rapidly.
The only solution I have found thus far is to use a batch file. Is there any other option?
There are some options:
Sleep a bit when the program is done, so you can read the output.
Call System.in.read() (again at the end of the program), which will wait until you type a char and hits enter.
Create your own little swing terminal, which doesn't close when the application code is done.
This seems like the jre used from the command line and from the registry are not the same (this can occur when multiple JRE's are installed)
Have you checked in your windows registry what is the jre used to run the executable jars ?
You can find more on the registry settings on sun's site
Seems to me that your main class does not even gets executed.
This would explain the quick open/close of console window.
Or is it possible that another program than java has the "jar" file type?
Happened to me after installing a Nokia software.
Using a batch file seems to be my best option. I suppose that's why Eclipse has a launcher.
Change the open with program to
c:\Program files\java\jre7\bin\javaw.exe