Pop up command line in Eclipse or NetBeans - java

currently for my Java code writing I am using Windows and JCreator 2.5 LE. It is ancient and has basically no frills, but it has 1 thing that I like about it. When I run/debug a program, a Windows command line windows pops up and my program runs. I really like Eclipse and NetBeans, NetBeans I like a little bit moreso, but when I run my code it comes up in that stupid tiny little console embedded window, now this might not annoy anyone out there, but I like how I get the full command line window to pop up and run my code in good old windows cmd.exe goodness. Maybe I'm just a scrub but that's what I'm used to, all C/C++ work I've done in CodeBlocks and/or MS Visual Studio IDE, when I hit run I have a command line window pop up just like in JCreator, so that's what I'm used to.
So please, is there any way to get either NetBeans or Eclipse to do what I am asking?

Add just a simple script / bat file to execute your main Java class.
In "start_app.bat"
cd path_to_build_dir
java package_name.Main
augument with pause and other stuff as you prefer.
Or you can modify your build as described here http://wiki.netbeans.org/CLIProjectInConsoleWindow#How_to_run_a_NetBeans_project_in_an_operating_system_console_window

Related

How can I set the path to my Java decompiler in VSCode

I am relatively new to stack overflow, VSCode, and programming. I am using a Mac. I downloaded VSCode for use with Python around two months ago. I can not run my code in VSCode but I enjoyed working in VSCode so I would write in it and run my code outside of it. Now I have the same issue with Java. I can not "solve," this in the same way because I do not know how I can run my Java code outside of an IDE.
I first read the instructions for setting up VSCode for Java on VSCodes website. I followed the instructions but when I tried to run a, "Hello world," program it said I did not have a debugger. I re-installed Redhat's Java support, closed and re-opened VSCode, and tried to run it again. This time it said java.jdt.Is.home is pointing to a missing or inaccessible folder. I looked this up found one description of this issue from 2018. I had a hard time understanding what it was asking me to do but at my best interpretation I wrote "which java," in Terminal and copy pasted what it returned (usr/bin/java) into settings.json after "java.home: ". This gave me an error stating that it is outdated and I should change it to, "java.jdt.Is.home: " so I did. I also tried adding "local/" between "usr/" and "bin" as it appeared in my path to my Python3 interpreter. All of these gave me the same error when I tried to run a hello world program.What can I do to solve my issue with Java in VSCode?
which java can not get the right java home.
You need to take /usr/libexec/java_home or /usr/libexec/java_home -V.
Java home on MacOs looks like: /Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home
But You need not set the "java.jdt.ls.java.home" at all. Because the JRE has been embedded in the Language Support for Java(TM) by Red Hat extension.
Only the universal version without embedded JRE can specify the java.jdt.ls.java.home manually. Otherwise, it will search JDK_HOME JAVA_HOME current system path.
You can refer to the official dosc.
So, have you installed the related extensions? You can install Extension Pack for Java, which contains the extensions you need.
I am a little confused about why you can not run the python or java codes, it's very rare. After you installed the related extensions(Python Extension Pack) , just right-click in the editor, you can select the Run Java Debug Java Run Python File in Terminal and so on. Or you can click the button on the top-right.

No easy run button when using Java in VS Code

I am a software developer and am having a problem with Visual Studio Code while trying to run Java. When running other languages (such as python) there is a green triangular button on the top right that allows an easy way to run my code, however, when I trying running Java there arrow is not there and I have to manually select "Run Code" from the "Run" ribbon at the top of the screen. Is there any way that I could get the same green run button when using Java? Thank you for your time.
Press crtl+F5 to run without debugging and F5 running with debugger.
You can use the integrated terminal for compiling and executing by using the javac <filename>.java for compiling and java <filename> for executing.
Set your own key bindings.
Preset shortcuts
Install Java Extension Pack in extension marketplace will solve your question, also you can install Code Runner which provides button for code running too.

How to work with NetBeans IDE 8.2 on Windows 7 64-bit with JDK

I've been having trouble using NetBeans IDE 8.2 with JDK on Windows 7 64-bit. NetBeans can compile code, but doesn't run it. I've downloaded all of the necessary files and programs and even consulted with a computer programming teacher, but I haven't been able to work around this issue. The URL displays an image that shows what I get back after attempting to run a code.
https://i.stack.imgur.com/RsEvx.png
I appreciate any help I can get.
Thanks,
--Sam
JavaApplication1.java is still set as your main class.
To change your main class, go into Project Properties -> Run and change "Main Class" to TestClass.java.
Essentially, the compiler is still running whatever main function is found in JavaApplication1.java.
#notyou Also mentioned how you can right click a file and run it directly, instead of changing the project settings. I used to use this but it slipped me! This is super useful.
I'm pretty sure this question has some answers for you.

Eclipse freezes when creating project/class (no loading bar showing)

When creating new project (Java) in Eclipse Mars.2 version, there's a problem, that appears as like "freezing" of Eclipse: after clicking finish, CPU usage jumps high, it shows that it is building the project but everything is still - there's not even a loading bar underneath.
It appears the same when creating Java classes. The same happens when I start program from terminal - with and without "sudo". While loading everything, I seem to see no errors.
What could be wrong? Dunno with what I should even start, but tell me, what specific info I should provide to investigate this.
I have tried changing GTK theme to something else, reinstalled Eclipse n-th times (did that by unarchiving and using installer provided from eclipse.org), reinstalled Java from ground-up, still nothing changes.
Dealing with this over 2 months, still can't find any solution. Many things I have tried, even researched related topics before posting this. Nothing helped from there.
Using now Ubuntu 16.04 (unstable, but it shouldn't be a problem, I guess).
You can create file run.sh in eclipse directory and add this content
#!/bin/bash
export SWT_GTK3=0
./eclipse
now run eclipse using ./run.sh instead of official ./eclipse launcher.
The problem is in the GTK version.
Just add this line to the eclipse.ini file just before
--launcher.appendVmargs
line -
--launcher.GTK_version
2

Eclipse (SWT composite): How to run and where is build?

I am new to Eclipse and Java programming having mainly worked with Microsoft Visual Studio.
I installed Eclipse (Kepler 4.3) with no issues along with WindowsBuilder and SWT.
I created a new project adding in references to SWT, both WindowsBuilder JARS, and resty. Into the project, I created a new package and selected a SWT composite. I gave appropriate names.
The GUI designer came up with no issues. I added in a couple of controls. The idea is to create a hello world application, display that application, and build it. Eclipse has automatically build checked.
Okay, the IDE in designer view shows the GUI of my Hello World application and the source view the source, so no problems there.
I press Run, and the first time I had to select a run configuration, which I selected EclipseStarter. There was not many options. I click on run and nothing happens.
If I go to the project's bin package folder, I see a file with a ".class" extension.
Why does pressing Run|Run (Ctrl+F11) do nothingness? There is a brief hour glass showing, but then nothing after that.
How do I launch the application from within Eclipse?
Is the generated ".class" file the correct runtime? I double click on that and Windows does not know what to do with it?
The end platform will be CentOS, but Java as I understand things, should be platform independent, so my Hello World application should run on my Windows 7 Pro box just as nicely. (I did not try CentOS yet) as I want to see it work on my desktop and know what file to copy over.
I think you selected the wrong option EclipseStarter.
Try running it as a Standalone Java Application.
It is a Standalone Java Application that you're building, right?
(I mean, the analogue of a Windows Forms App in .NET)
1. I guess because you selected the wrong type.
2. Ctrl+F11 is for Running it, F11 only is for Debugging it.
3. The class file has to be run by a JVM, Windows cannot run it directly,
it is not anything like a native executable or like a .NET assembly
(which Windows 7 knows how to run). But as you're using Eclipse you
already have a JVM.
The solution is multi-fold.
I had to delete Eclipse and install the 32-bit version of everything. That simplified life, as 64-bit caused issues running.
Create a new package
From the toolbar, select "Create new visual classes" drop down. Select "SWT" --> "Application windows".
Create the application window
Press the play button, 8th icon having selected the package first.
That enabled to run my Hello World on Windows. The output is a .java.
I still have a problem running from the command line, but that is a different issue.
Summary: My main issue was creating a SWT application window first and that I should have 32-bit for everything.

Categories