How to run Java code on Eclipse Juno - java

I'm learning Java and using Eclipse as main IDE right now, but i can't run Java code from it (There are no Run as or Debug option in the Popup menu).
And personally, i don't to use 2 difference version of Eclipse.
Thanks
Edit : I'm using Eclipse Standard 4.3 and it doesn't have run as \ Java Application 's option. It only exists in Eclipse IDE for Java Developers.

This is not the same version of Eclipse but the button is identical.

#illunara , I am using Juno since a long time now. You can run the program using one of the following way and it's pretty simple where is your confusion ??
1) refer to the following screen shot : You can right click on the java project you will see the run as option and from there you can choose on of the option to run as java application
2) You can go to run-> run as-> java application
3) you can right click the mouse on a java program and you can run from their too.
================================================================================================
EDIT
Just as you mentioned you have eclipse standard so you need to add the JDT plugins before you do the above. you can find more details at the following site :
http://www.eclipse.org/jdt/overview.php
Hope this is helpful.

Related

Problem in running Stanford assignment on eclipse

I am new learner of public sources of Stanford cs106a. I got sucked when run my assignment1. You can download it from here:
https://see.stanford.edu/materials/icspmcs106a/Assignment1.zip
I suppose to see the image on the following file after press run on Stanford menu and choose CollectNewspaperKarel code.
https://see.stanford.edu/materials/icspmcs106a/07-assignment-1-karel.pdf
But there is no any Karel or his world. I didn’t get any error. I am running eclipse 2018-9 and my JDK version is 11.0.1 on macOS Sierra 10.12.3. I added the Stanford plugin as well. I do the following instruction for installing eclipse and the plugin:
https://web.stanford.edu/dept/cs_edu/eclipse/
How should I solve my problem to see Karel at result window after run assignment?
P.S. My English isn't good actually!
I also had a same problem with those files.
The Assignment1.zip file seems working with the Java 6 runtime only.
You can still run it by downloading the legacy Java 6 runtime here and install it.
https://support.apple.com/kb/DL1572?locale=en_US
Then you need to configure to use the runtime.
Preference -> Java -> Installed JREs
Click Search
Select /Library/Java/JavaVirtualMachines/1.6.0.jdk
Check it
Preference -> Java -> Compiler
Select 1.6
However, I actually found newer assignments files which work with the updated Java runtime.
https://web.stanford.edu/class/archive/cs/cs106a/cs106a.1178/
If you follow the Eclipse link, there are instructions to setup it.
You can also find each assignment page links.
For example, find Assignment 1: Karel the Robot on the above page and follow the assignment page link below.
Find Click here to redownload the starter code if you have already completed the Honor Code form.
You can download CS106A-Assignment1.zip which works with the updated Java runtime.

VS Code Java Debugger

I installed VS Code Java Debugger and loaded my Java project.
Add Configuration:
I tried to add configuration by clicking the button as shown in above image.
Activating Extensions:
When I click Add Configuration, I get Activating Extensions like above and that's it.
Sometimes I get "The Language Support for Java crashed 5 times in the last 3 mins."
How do I setup the Java Debugger in VSCode?
Note : I Uninstalled VSCode, deleted the extensions from %Users%/.vscode/extensions and reinstalled VSCode and extensions. The issue still exists.
For me, the following actions fixed this issue:
Un-install all Java related extensions.
Re-install the Java Extension Pack only.
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack
I was facing the same kind of error but one day found a solution
https://stackoverflow.com/a/61806765/5108695
Basic idea is to:
Install an extension called Lombok Annotations
https://marketplace.visualstudio.com/items?itemName=GabrielBB.vscode-lombok
After installation of this extension, my Java code is able to run and debug in VSCode.
PS: Make sure you had insalled Java Extension pack
https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack

JavaFx not showing up in preferences window

I am trying to work with JavaFx for the first time . Right now, I cannot see the option for JavaFx in my preferences window (Eclipse -> Preferences -> JavaFx?) as shown here:
Preferences Window.
I have Java 1.8.0. installed on my mac.
Eclipse itself does not know anything about JavaFX and in fact it does not have to because a JavaFX program is nothing but a plain Java program.
In order to get some additional tooling you can however install this plugin. e(fx)clipse This is helpfull but not necessary to write a JavaFX program in Eclipse.
Sometimes you may need to manually look up the repository.
I used this walkthrough to do it Install efxclipse into eclipse
The actual repository is here (as of Feb 24,2020): http://download.eclipse.org/efxclipse/updates-released/3.0.0/site
You will need to restart your Eclipse instance.

Can't create java application project in netbeans8.1.(ubuntu)

I am new to NetBeans and I can't create a "Java Application" project, like shown in all tutorials. I can only create a Java Free-Form Project, but this requires a build script, which I don't have either.
Do I have to download a plugin for it and if so which plugin? Or did I download the wrong NetBeans version?
I am using ubuntu version 15 and NetBeans IDE 8.1.
http://imgur.com/90AeiDG screenshot.
Just make sure you have JDK installed on your system. (I am pretty sure, it would be as Netbeans doesn't install if JDK is not found on your machine, but just to be sure about it). Also, You might have missed to select Java in Select Languages during installation.
To activate a feature manually:
Open the Tools > Plugins menu
Go to the Installed tab.
Select and activate the feature you need.
Return to the New Project dialog.
Visit this link for more help:
http://wiki.netbeans.org/FaqMissingProjectCategories
Found the plugin:
It was in the the "Ant" or the "Ant 1.9.4. Documentation 1.9.4" or Mobility plugin. I downloaded those 3 at the same time, but If I have to guess it was the Mobility plugin.
Not sure if this will help you. I've been working on Windows. I have Netbeans 8.1 and JDK 8 (version 1.8.0.73). When I first started with Netbeans and tried to create my first new Project it opened the New Project window with the Categories portion of the new Project screen focused on the Samples section. I also thought I couldn't create the type of project I wanted to create. If this is what is happening to you, see if you can scroll up in the Categories box. If you can, you should find Java at the top. If you click that, you should then be able to select Java Application in the Projects part of the window.

Unable to run Java program in Eclipse Juno 4.2

I reinstall my Eclipse environment every year when the new version is released. The most recent release - Juno - however, does not work as expected.
Currently, when I try running demos from Oracle, for example, it asks me to select an Ant file to run before compiling. After creating a blank Ant file to bypass the requirement (which I thought was rather dumb, since I don't think TDD is something that should be forced on people), it still refused to run, saying the "Selection could not be launched."
I understand that Juno is an update from the 3.x track to the 4.x track, but this seems a little ridiculous to me. What can or should I do so I can get Eclipse back up and running again?
Just to clarify:
All files in question are on my Eclipse workspace path
I don't do much in the way of Java development, though I know I'll need to do so soon. Hence, my unfamiliarity with the most recent version of Eclipse.
I would like to run my files & projects without Ant files. I know it has something to do with Run configs, but I don't know how to change them.
Here's what I did to run the demo from Eclipse Juno:
Downloaded the project from http://docs.oracle.com/javase/tutorial/uiswing/examples/zipfiles/components-FrameDemoProject.zip (if this is not the correct demo, then please provide the link you're using)
Unzipped it to my projects directory (not my workspace), so that you have:
PROJECTS_DIR/components-FrameDemoProject/src
PROJECTS_DIR/components-FrameDemoProject/nbproject
PROJECTS_DIR/components-FrameDemoProject/build.xml
From Eclipse, File > New > Java Project
List item Uncheck Use default location and navigate to <PROJECTS_DIR>/components-FrameDemoProject
Hit Finish
Drill down to src/components/FrameDemo.java
Right-click on FrameDemo.java and select Run As > Java Application
Let me know if any of these steps give you trouble.
Take a look at you project properties and select the Builders entry. Do you see an Ant Builder entry? Try to select or create a Java Builder entry instead.
I just created a new Java Project in Juno and added the FrameDemo.java source. In my case, the Java Builder was selected as the default for this new project.

Categories