Error running simple program in NetBeans 9.0 - netbeans

I'm trying to use NetBeans for a JDBC project. However, I'm getting runtime errors when I try to compile. I decided to try a "hello world" project and I couldn't get that to run also. I'm in NetBeans 9.0 with Java JDK 10.0.2.
Error Message:
Exception in thread "main" java.lang.RuntimeException:
at javaapplication2.JavaApplication2.main(JavaApplication2.java:1)
C:\Users\James\AppData\Local\NetBeans\Cache\dev\executor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\James\AppData\Local\NetBeans\Cache\dev\executor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 1 second)
xml debug:<call-java classname="#{classname}" classpath="#{classpath}" modulename="#{modulename}" modulepath="#{modulepath}">
package javaapplication2;
public class JavaApplication2 {
public static void main(String[] args) {
System.out.println("Hello");
}
}

It is very easy, your JDK version is not 100 % compatible; use version 8.2, which is the most stable for Arduino and others.
To change platforms without deleting the existing one, simply go to Tools / Java Platforms / click on the button add Platforms.

Download/install JDK major version number the same as NetBeans.
i.e. If You have NetBeans 9 version, but your JDK is version 10,So try use NetBeans 10 version... or download/install JDK 9 (the same as NetBeans).
Create new java platform for new jdk installation.
Open netbeans menubar->tools->Java Platforms->Add Platform Specify the folder that contains the Java platform as well as the sources and Javadoc needed for debugging.
Set new java platform to your project
Right click on project ->properties->Libraries->Java Platform->select the jdk version that same as NetBeans.
Select source format of your project
Right click on project ->properties->Sources->Sources/binary format->select the jdk version that same as NetBeans.
If it still give same error,Open the project properties, select the Build-Compiling, uncheck "Compile on save" and rerun the application. This will make sure all your source code becomes recompiled before running it.

Related

export with jdk 8 still got error when start server

I used eclipse with jdk 8 to export to jar. Yet i still get this error when start my server sfs
Exception in thread "main" java.lang.UnsupportedClassVersionError: sfs2x/extension/mmo/MMORoomDemoExtension$NPCData has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Could someone tell me how to fix.
I tried to uninstalled all java and install jdk8 only. But nothing change.
I had a similar problem, what fixed it for me was making sure that jdk8 was selected as the build jdk for that project (right click on your project in Eclipse and click on properties -> Java build path -> JRE System Libraries -> Workspace Default JRE, make ure that jdk8 is selected) and then recompiling. I was able to delete all .class files before recompiling as well, but that may be difficult if this is a project.
Best of luck.

GWT hello world app does not compile and asks for 'com.google.gwt.core.Core'

I haven't done GWT development for a while and wanted to try again. In my Windows 10, I installed JDK 12 and Eclipse 2019-03. I installed GWT Eclipse Plugin (GWT 2.8.1).
From Eclipse, I created a hello world project this way:
Click on 'New GWT Application Project'
Project name: Gwt5, Package: com.foo, Use default SDK (GWT 2.8.1)
Click on 'GWT Compile Project'
I see this error:
Compiling module com.foo.Gwt5
[ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
I didn't change my gwt.xml. I checked and "com.google.gwt.user.User" is there.
Any suggestion?
When language compliance level or JRE is set to higher than what GWT supports, this error occurs (The error message is not very helpful though).
As of May 2019, GWT supports only up to Java 8, and that is provided by JDK 1.8. For example, to make GWT work with Oracle's JDK, you need to download an older version of JDK (Java SE), than set both the Compiler compliance level and Installed JRE to:
Compiler compliance level: 1.8
JRE Home: C:\Program Files\Java\jdk1.8.0_202\

I couldn't build Jhipster sample app

I'm trying to run Jhipster sample app in my Eclipse kepler . I've downloaded the project from here and I've imported it as existing maven project but it couldn't be build . I got this exception :
The type java.util.Optional cannot be resolved. It is indirectly referenced from required .class files AccountResource.java
and many "Undefined CSS file" errors
how can I run this project in my Eclipse ?
Normally you should create your application using the yeoman generator. Install yeoman and execute yo jhipster from your command line.
a)For the java exception basically you need to remove the old version of java from your build path and add support for java 8.
You need to follow these steps
1) Right-click on project » Properties » Java Build Path
2) Select Libraries tab
3) Find the JRE System Library and remove it
4) Click Add Library... button at right side » Add the JRE System Library(Workspace default JRE)
Do not forget to set the Java jdk compiler compliance level to 1.8 (Preference -> Java -> compiler )
b) The jhipster site mentions about the configuration settings(css,javascript and html etc)for eclipse to avoid errors in eclipe. https://jhipster.github.io/configuring_ide_eclipse.html

org/eclipse/e4/ui/model/application/ui/MUIElement Class Not Found , Java Eclipse Juno

I am doing a CIMTool project, for a handle of WorkbenchWindow
Code Snippet
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
//(both these Classes are present in Libraries)
IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
Issues
Following Error is slapped
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/e4/ui/model/application/ui/MUIElement
at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:90)
Environment
Eclipse : Eclipse Java EE IDE for Web Developers, Version: Juno Service Release 2
OS : MS Windows 7 Professional, X86
Java Version : java version "1.7.0_25"
Questions
I tried searching for org/eclipse/e4/ui/model/*, I could not find in
Archives. Where I can find ?
Is there any otherway to get IWorkbenchWindow Instance ? (want to
avoid this issue)
This problem I found that, doesnt appear in Java Indigo. But my project has to be developed in Eclipse , so I cant migrate.
thanks
I also was confronted with this error when executing code from within a project that was created as "SWT/JFace Java Project" using Eclipse Kepler (displaying a ListSelectionDialog).
The main problem is that the project set-up misses a JAR file that contains the MUIElement class. You can easily fix the project set-up by editing the build-path, adding the external jar which has a name similar to this one:
org.eclipse.e4.ui.model.workbench_1.0.1.v20131118-1956.jar.
You find that jar in the plugins directory of your Eclipse installation.

Eclipse doesn't show java source code

I'm running java 1.6 in Eclipse on my Intel Mac. I'm using the 1.6.0 version under System/Library/Frameworks and set the default compiler to this in Eclipse.
How do I attach the source code?
First, I downloaded the 1.6 source from oracle, thinking I could attach that 'cause the installed 1.6 didn't have source.
When I click a java class to get the Source Code Editor, there are problems:
first, the top line says Compiled from File.java (version 1.5 : 49.0, super bit)
most important, when I attach the 1.6 source jar file, it gets an error:
An error has occurred. See error log for more details.
Unable to create resource org.eclipse.ui.internal.misc.ExternalProgramImageDescriptor#50417ba8
This also appears in the error log:
java.lang.ClassNotFoundException: org.eclipse.ui.internal.views.log.LogView
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
The Eclipse version is: Eclipse Java EE IDE for Web Developers.
Version: Helios Service Release 2
Build id: 20110218-0911
When I click for installation details, I get:
An internal error occurred during: "Fetching children of _SELF_".
Registry Directory not available: /Users/rfrail/Downloads/eclipse 2/p2/org.eclipse.equinox.p2.engine/profileRegistry.
I'm running Eclipse from my Download directory (it's worked fine in the past); however, there are 2 folders for Eclipse:
eclipse, and
eclipse 2.
So that looks like a source of confusion right there. Eclipse operates fine otherwise.
Can you help, please?
http://java.decompiler.free.fr/ is your answer
it has an eclipse plugin which decompiles code in place