Java swing on eclipse oxygen 4.7.3a? - java

I am trying to use windowbuilder on eclipse oxygen 4.7.3a on macOS highSierra. it installed fine but every time I try to open the design part it displays this error
Eclipse is running under 0, but this Java project has a 1.8 Java
compliance level, so WindowBuilder will not be able to load classes
from this project. Use a lower level of Java for the project, or run
Eclipse using a newer Java version.
I tried everything. like changing the running enviroment, .jre files, try different JDE. nothing working. any suggestions?

Your only short term solution is to use a Java version <= 9.
Initially WindowBuilder did not work with Java 9 for several reasons. See
Bug 526098 - WindowBuilder fails to work on Java 9.
One of those issues was that the the System Property java.version was unexpectedly just "9":
Please check that you have exactly 9.0 JDK, it worked for me with
9.0.1 until I downgraded target JRE to 9.0, which has unusual System.getProperty("java.version").equals("9")
The fixes to get WindowsBuilder working on Java 9 were only completed on 2/21/18, and based on your error it looks like a similar issue exists when running WindowsBuilder using Java 10. I suggest you create a Bug Report with Eclipse.
See also:
SO Post Eclipse Oxygen Window Builder Error with Java SE 10.0.1 where the solution/workaround was to regress to Java 9.
This Eclipse Forum post where a user is reporting a similar problem to yours.

Uninstall Java Version and Install lower version of Java(8).Support for WindowBuilder is not provided anymore.
How to uninstall current version?(Mac)
Go to /Library/Java/JavaVirtualMachines/ to see current version of java and replace jdk1.8.0_131.jdk with yours.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf ~/Library/Application\ Support/Oracle/Java
Install Java 8:
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Then:
Right click on your project and go to Properties
Make sure your configuration look like this,
At the top of picture Configure Workspace settings click on it (Uncheck project specification settings) and then see image below
Apply same as in picture Then enable "project specification settings"
Restart Your Eclipse
Done!!

Related

Can't specify SDK in Intellij on Linux

I am running IntelliJ IDEA 2017.1.6 Pro on a Linux (Ubuntu) machine and, it will not let me select an SDK for any Java project.
Whenever I start up the program and go to "Create a New Project" Java has no SDKs available. If go to new and try to specify where my JDKs are installed (I have a few) it always fails with the same error:
I've tried specifying the locations:
/usr/lib/jvm/
/usr/lib/jvm/java-11-openjdk-amd64/
/usr/lib/jvm/java-8-openjdk-amd64/
/usr/lib/jvm/openjdk-11/
/usr/lib/jvm/jdk-14.0.2/
/usr/lib/jvm/default-java
/usr/lib/jvm/java-1.11.0-openjdk-amd64
/usr/lib/jvm/java-1.8.0-openjdk-amd64
(these last three are all just symlinks)
I know I have a JDK installed for my default Java version. I can compile and run code via command line:
justin#stephanie:~/temp$ ls
HelloWorld.java
justin#stephanie:~/temp$ javac HelloWorld.java
justin#stephanie:~/temp$ ls
HelloWorld.class HelloWorld.java
justin#stephanie:~/temp$ java HelloWorld
Hello, World!
The output of readlink -f $(which java) is /usr/lib/jvm/java-11-openjdk-amd64/bin/java (same location for javac exectuable).
Everything I've looked at online suggest that I should just be able to select /usr/lib/jvm/java-11-openjdk-amd64 as my Java SDK but it is failing. I feel like I must be misunderstanding something essential here as I don't know why this isn't working.
Any help would be useful, I've never used IntelliJ before (I've always been an Eclipse user) and it is very frustrating I can't even create a project in it after a couple hours of trying to mess around with it.
1. Please try first with a newer version of IntelliJ, preferably the most current one (currently this is 2020.2)
2. I had the same problem (with version 2020.2 on my Kubuntu system) and fixed it by simply downloading and installing the SDK via IntelliJ.
The /usr directory is mounted at /var/run/host.
You should find your jdk under /var/run/host/usr/lib/jvm.

How to fix error while installing NetBeans?

I have installed Java and am trying to install NetBeans 11.3 on my Windows 10 but after I ran the exe. installer, an error message popped up:
An unexpected exception happened in thread main
java.lang.NoClassDefFoundError java/util/jar/Pack200
NetBeans have problems with the jdk-14, because I suppose that you have install the jdk-14 so uninstall it and try it with the jdk-13.0.2.
Sorry, but in my opinion is to install an old version from Java no solution, just because it works. When someone has problems with his Firewall, simply disable the Firewall would also be no solution.
https://www.java.com/en/download/faq/other_jreversions.xml
We highly recommend users remove all older versions of Java from your
system. Keeping old and unsupported versions of Java on your system
presents a serious security risk. Removing older versions of Java from
your system ensures that Java applications will run with the most
up-to-date security and performance improvements on your system.
The "real" solution would be a reprogramming of the NetBeans installer.
This used function was suggested for deprecated on 2018-04-04, which was done on 2018-08-23.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8200752
The removal was suggested on 2019-10-08, which was done on 2019-12-18.
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232022
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8232022
We assume that developers who rely on Pack200 have had enough notice about its proposed removal to make alternative arrangements. … We assume that developers who use pack200 to shrink application JARs can switch to either the jlink tool or the jpackage tool to create application-specific runtimes with an optimized form factor.
edit: I solved it this way.
uninstalled JDK 14
installed JDK 13.0.2
installed Apache NetBeans
installed JDK 14
open C:\Program Files\NetBeans\netbeans\etc\netbeans.conf and changed path to JDK
uninstalled JDK 13.0.2
Now NetBeans runs with the JDK 14.
Yes, I got it working as follows from cmd, when referring to older version:
Apache-NetBeans-11.3-bin-windows-x64.exe --javahome "C:\Program Files\Java\jdk-12.0.2"
The https://netbeans.apache.org/download/nb113/nb113.html site now has this
memo:
The installers will not run under JDK 14 because usage is made of the Pack200 Tools and API, for packing and unpacking, which is removed in JDK 14, see JEP 367.
If several JDK versions are installed, then you need to define the environment variable "JAVA_HOME" where to set the path to JDK-12.
Details are described here. (Only in Russian)
An alternate way to Andy's.
(Windows)
1) Right click on "Apache-NetBeans-11.3-bin-windows-x64" installer and select "Create shortcut".
2) Right click on the created shortcut and select "Properties".
3) In the "target" textbox, add your under 14 JDK version path at the end, here is how mine looks like:
C:\Users\userfoldername\Desktop\Apache-NetBeans-11.3-bin-windows-x64.exe --javahome "C:\Program Files\Java\jdk-13"
4) Press Ok when done, double-click on the shortcut and it should install fine now.
Switching to openJDK 12 worked for me too. But instead of uninstalling JDKs or manually changing the env, I use Sdkman.io which works like Node version manager if you have used that. It manages your JDKS for you and offers downloads of different versions (Open, Zulu, Graals) and will switch between them with with just a quick command.
I found a nice solution in 3 steps:
check all versions of the JDK path in Environment variables, if there is an outdated path please remove it and keep the latest version of the Java JDK bin path.
after the second step, please uninstall the Netbeans and re-install the latest version.
Netbeans will found the latest JDK path in case it was jdk14 and choose JDK latest version path for NetBeans.
solved
Just install JRE from oracle. Everthing will run fine. I have the same issue

Can't install Eclipse - "Failed to create the Java Virtual Machine" on Mac

I'm trying to install Eclipse, but I can't get the installer to start. It fails with
"Failed to create the Java Virtual Machine"
How can I resolve this?
Note: I'm on Mac.
Edit the file /Applications/Eclipse.app/Contents/Info.plist
There is a comment for use a particular JVM:
<key>Eclipse</key>
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V -->
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk8u192-b12/Contents/Home/jre/</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
It took me some time to figure this out as well. The main takeaway was eclipse does not support SDK Version 14 (as of eclipse 2020-03). That was not completely obvious to me.
Install a supported version (I used Homebrew to install SDK V8 🍺):
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
If this is the only Java Version you have installed you should be fine and Eclipse should open up. If that is not the case and you have another Java Version installed. You have to tell Eclipse which Version of Java it should be using (see Step 2).
Tell Eclipse which Version to use by editing the /Applications/Eclipse.app/Contents/Info.plist file as described by Juan Ignacio Barisich and Brad Parks. That being the version you installed in step 1.
nano /Applications/Eclipse.app/Contents/Info.plist
# or
open /Applications/Eclipse.app/Contents/Info.plist
<key>Eclipse</key>
<array>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-vm</string>
<string>/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/</string>
</array>
Disclaimer: Please bare in mind that those were the steps I took to get eclipse running again. Because I'm nowhere qualified to give a precise answer about this please take a look at the comments in case I got something wrong.
Edit: See Christian Fries answer who pointed out that all java versions 8 to 13 are supported by eclipse.
For me, I had to edit the eclipse-inst.ini file located here:
Eclipse Installer.app/Contents/Eclipse/eclipse-inst.ini
and add the path to my local java VM at the very top of the .ini file, which is here:
-vm
/Users/bparks/jdk/jdk1.8.0_162_x64/bin/java
If the Eclipse Installer.app file is in a DMG, right click on it, and copy it, then paste it into another folder. Then right click on that app file, and choose "Show Package Contents", to get into the files inside the application.
If you've already got Eclipse installed, and find it's throwing the same error, you could try a similar approach by editing the following file for Eclipse:
/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini
On mac, you can get the full path you'd need to your java exe by running the following in a terminal, which will copy the path to your clipboard.
$ echo $(/usr/libexec/java_home)/bin/java | pbcopy
Note: The error "Failed to create the Java Virtual Machine" also exists with Eclipse 2020-03 (under some situations, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=561273) and it is not required to use Java 8 (with Eclipse 2020-03).
For the impatient:
You can run Eclipse or the Eclipse Installer with a given VM without changing eclipse.ini by starting it via a command line:
Open Terminal an run:
open PATHTOECLIPSEINSTALLER/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/NAMEOFJDK/Contents/Home/bin
where PATHTOECLIPSEINSTALLER is the path of the folder where Eclipse Installer is located and NAMEOFJDK is the name of the folder with the JDK (11, 12, 13).
For example:
open Downloads/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin
In the installer you may select the VM used by Eclipse. Use a compatible VM here and the installer will modify the eclipse.ini for you.
Explanation TL;DR
To clarify this issue:
Eclipse - say Eclipse 2020-03 - runs with Java 11, Java 12, Java 13, but does not run with Java 14. It fails with the message "Failed to create the Java Virtual Machine". This happens for the installer and for Eclipse itself.
You can download Eclipse without the installer from here: https://www.eclipse.org/downloads/packages/
Explanation:
On macOS, if you start a freshly installed Eclipse, it will use the default JVM. The default JVM is obtained by running /usr/libexec/java_home.
This program /usr/libexec/java_home will find the installed JDK with the highest version as default. That is, if you have JDK 14 installed and run Eclipse 2020-03, you will see this error.
Solution
Summarising some other answers here, there are three options:
Once you have removed JDK 14 from /Library/Java/JavaVirtualMachines/ the error will be gone.
If you like to have JDK 14 installed, start the installer with a different JDK via the command line open Path-to-Eclipse-Installer/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/NAMEOFJDK/Contents/Home/bin
You may edit the eclipse.ini (as suggested in other answers) to use a specific JVM.
Referring to Marseille Joseph
https://www.eclipse.org/forums/index.php?t=msg&th=1102885&goto=1823113&#msg_num_13
This worked for me!
Their solution didn't require uninstalling jdk14 or to editing the eclipse.ini file. Instead, do this:
cd /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS/
sudo rm /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS/libjli.dylib
sudo ln -s /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/libjli.dylib libjli.dylib
I started facing the same problem in mac suddenly after updating to macOS Monterey, So I just did the following steps:
Then go to Contents/Eclipse/eclipse.ini file and open it with any text editor and you will see the following:
Add below line before -vmargs as shown in above image:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java
This below line will be different for all the users:
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java
and you can just get this line copied to your clipboard using this command in terminal:
$ echo $(/usr/libexec/java_home)/bin/java | pbcopy
Similarly will be for STS:
Then go to Contents/Eclipse/SpringToolSuite4.ini as shown below and open with any text editor app.
You will see the following:
Just add the same line that you added for Eclipse in the above steps:
delete all java folder inside /Library/Java
then install a new jdk from
https://adoptopenjdk.net/
which will install at
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk
then try reinstalling eclipse a
I had the same problem in my mac. Here is my solution.
First: I've uninstall all the versions of jdk, because I've try a lot of options.
To do this, you need to go to Library/Java/JavaVirtualMachines
and delete all the folders.
Second: Install jdk 1.8 here is a link to download this version:
jdk 1.8
Third: Install eclipse 2020-03 and thats all.
If you want to use JDK 14, you need to follow this steps:
Open eclipse
Go to Help > Install new software
In the Install window copy the following link in Work with https://download.eclipse.org/eclipse/updates/4.15-P-builds/
Select the third option show in the picture below
Then, click "next" and finish the install
Now you have to change the options, go to Preferences (command + ,) > Java > Compiler and search the version 14. Before this step you need to install jdk 14 (link) Perhaps eclipse would suggest you to change to the correct JREs, for this you need to go to Java > Installed JREs and add the correct version. When you click add you need to choose he JRE type, in my case I use a MacOS X VM and Standard VM, then you have to choose the directory (/Library/Java/JavaVirtualMachine/jdk-14/Contents/Home and click open you could give a JRE Name and finish eclipse will be restart and now you can use eclipse with java 14.
This works for me, I hope you have understood me.
Go to /Library/Java/JavaVirtualMachines
Delete all version except one in use.
Install jdk 8 from brew work for me. You can get the instruction on installing Jdk 8 from HomeBrew here How to install Java 8 on Mac
I met this problem with eclipse-java-2020-03-M2-macosx-cocoa-x86_64, and opendjdk11. The latest eclipse installer at the moment also complained same error.
After I switched back to openjdk8, everything goes well...
For Windows OS:
open eclipse.ini in the Eclipse program folder
add the below lines at the top of the file
-vm
path-to-java-bin\javaw.exe (for example: C:\Program Files\Java\jdk-11.0.10\bin\javaw.exe)
I mounted eclipse dmg file and copied eclipse inside Applications. Then I tried to modify file Info.plist located inside Contents as below, but was getting that this file Info.plist is readonly error. I noticed that I already have read and write permission but still it was giving me that read only error. Then I moved the contents of Eclipse to some other local folder and then edited Info.plist, it did not give me readonly error.
<array>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
Finally I am able to open eclipse.

Fedora updates make Eclipse forget Java

(Not sure if this is an okay place to ask, but i'll try). After installing some updates in Fedora 16, Eclipse no longer knows how to use Java files. It can't make them, or compile them, or format the syntax. It's just eclipse without any Java whatsoever. I checked the yum.log and it installed about 6 eclipse updates and 2 java updates. A solution I found on the internet was to delete .eclipse and have eclipse regenerate it, but that didn't fix anything. Anyone know what's up?
The problem is documented here:
http://lists.fedoraproject.org/pipermail/devel/2012-January/161092.html
and this is the bug:
https://bugzilla.redhat.com/show_bug.cgi?id=760454
Basically, we were caught between a rock and a hard place and had to break a packaging loop so this broke people's existing installations. Move ~/.eclipse and restart Eclipse and you should be fine.
$ mv ~/.eclipse{,.bakBug760454}
I have faced a similar problem, it would be best in my opinion to remove every package for java and eclipse all together. You can find installed packages with:
sudo rpm -qa | grep keyword
where keyword would be for example 'jre', 'jdk' or 'eclipse'.
Once you find the packages you don't want, remove them with
sudo yum remove packagename
Then I would recommend you to skip default jdk available for linux and install the one provided from the Oracle website: http://www.oracle.com/technetwork/java/javase/downloads/index.html
I have installed version 6 myself as I had some maven problems (m2eclipse) with Java 7.
Download the rpm, install it and set you path to java in .bashrc file.
Check all your installed jre/jdk with
sudo alternatives --config java
or
sudo alternatives --config javac
and set the apropriate option if necessary.
Next, go to the eclipse website and download the latest stable release of eclipse and you should be fine. You can integrate it with the desktop as well so you won't have to start it from the command line every time.
Check all of the available eclipse* packages. "Eclipse" itself is just a plug-in platform with a lot of UI components, it's not a Java IDE unless you also install those plug-ins. It's possible that the packaging was changed in a way that the Java plug-ins were no longer included in the packages you have installed after the upgrade completed.

Eclipse 3.6 Helios for Ubuntu 10.10 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have ubuntu 10.10 net book edition installed on my dell studio laptop. I downloaded helios for the eclipse site but when I am not able to run it. I have downloaded eclipse 3.5 from synaptic package manager but I am not able to update eclipse 3.5 to eclipse 3.6. Is der any other way to have updated eclipse? Eclipse 3.6 supports HTML 5.
Please let me know, thanks a lot in advance
Try this:
To install eclipse on ubuntu you need to download it first from http://www.eclipse.org/downloads/
Extract the downloaded file by right click on it and extract here or running the following:
tar xzf dir/eclipse-SDK-3.3.1.1-linux-gtk.tar.gz
Where eclipse-SDK-3.3.1.1-linux-gtk is your eclipse-SDK name with version and dir is the directory of eclipse-sdk.
Now move it to the root directory. Apply the following command to do this.
sudo mv dir/eclipse ~
Now you are ready to configure your eclipse. To do this follow the following step by step...
sudo mv eclipse /opt/
Take care of the permissions:
sudo chmod -R +r /opt/eclipse
sudo chmod +x /opt/eclipse/eclipse
Create an executable in your path:
sudo touch /usr/bin/eclipse
sudo chmod 755 /usr/bin/eclipse
sudo gedit /usr/bin/eclipse
Copy the following content and save the file:
#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*
Let’s also make eclipse executable everywhere by creating a symlink:
sudo ln -s /usr/bin/eclipse /bin/eclipse
Create the menu icon:
sudo gedit /usr/share/applications/eclipse.desktop
Type in this content and save:
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=/opt/eclipse/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
Run for the first time:
eclipse -clean
You can now start Eclipse by simply typing eclipse in the terminal or from the GNOME menu Applications -> Programming -> Eclipse
At least, you still have the manual install, which leaves your current Eclipse3.5 untouched (allowing you to go back to it if 3.6 gives you too much troubles)
To get your 3.6 download running:
Unzip the download into a directory you have complete control of, usually a directory under your username, preserving folders.
Create a shortcut to the eclipse executable, usually in the resulting "eclipse" folder.
Run the program using the resulting shortcut.
When your new eclipse install starts, point to your existing workspace.
You can continue with both 3.5 and 3.6 installed using the same workspace, or you can remove 3.5 by deselecting it from your software management program (one of several ways).
Alexander Pogrebnyak actually points out in the comment:
workspace cannot round trip 3.5->3.6->3.5.
The usual solution is to keep 3.5 and 3.6 versions of workspace in different directories.
The idea to have one workspace for each version is always the safest route to take, with each of your project imported into each respective workspace.
Note, you have to make sure your java is correctly installed (which should be already good for you, but just in case):
Installing Helios 3.6 on Ubuntu 10.10 is rather simple.
Download eclipse package from eclipse.org and extract it to a folder in your home directory.
The tricky part is setting up java6-jdk from the sun partner repository but there is a easy to follow guide:
basically you have to enable the partner repository, then install java6 jdk with:
sudo apt-get install sun-java6-jre sun-java6-plugin
and then if necessary update your java alternatives with:
# shows a list with available java alternatives:
sudo update-java-alternatives -l
# sets the alternative
sudo update-java-alternatives -s java-6-sun
sudo update-alternatives --config java
The Eclipse version available through the official Ubuntu channels is 3.5 and should not be manually upgraded to 3.6. You probably will not have write permission to do so.
If you must have 3.6 the easiest way is to download the official distribution from eclipse.org, unzip it and run the eclipse binary directly. This also allows you to fully administer it by yourself with upgrades and extra modules.
The Eclipse version available through the official Ubuntu channels is 3.5 and should not be manually upgraded to 3.6. You probably will not have write permission to do so.
There is a PPA available, that should let you upgrade through package management before the packages reach the Ubuntu repos. Sadly, the packages seem broken right now.

Categories

Resources