Eclipse (Java/SWT App): Reconfigure to run as 64-bit - java

I am trying to reconfigure my Java WindowBuilder SWT application to be 64-bit, not 32-bit.
My development machine is Windows (Win7, 64-bit), but the code needs to run on CENTOS too. Everything was working as 32-bit.
I cannot seem to shake this error. I did see the following articles here on StackOverflow.
issue 1, issue 2, issue 3
As per other developers recommendations, I did the following:
1. I went Window | Preferences and set the JRE to the 64-bit version
I then made absolutely sure to reference the 64-bit version of the SWT file. I even placed the 64-bit SWT in the project's /lib folder.
Steps: Right click project | Build Path | Configure Build Path... | Libraries
The run (project right click | Run As | Run Configuration...) and debug (project right click | Debug As | Debug Configuration...) configurations use the project environment JRE, which is what I set in step 1, or so I think.
I modified the eclipse.ini (with Eclipse closed) and added the following line to the end:
-vm "C:\Program Files\Java\jre7/bin/javaw.exe"
The 32-bit version is in "C:\Program Files (x86)".
I am still new to Java programming, so what step did I miss?
I am seeing the error if I run from the project folder in a command window or through Eclipse using the Debug configuration (F11 in Debug view).
Command Line Error:
Debugging Error:
UPDATE:
I might have answered my question, just not sure. I see at the bottom of this issue that the author said that he overlooked the Eclipse version. I see via the shortcut properties that I am using the 32-bit version (installed into the "C:\Program Files (x86)" folder). As there is no installatino program, I assume that I downloaded the 32-bit version. Could that be the problem? (I am trying the 64-bit version now.)
I would think that switching SWT over like I did would have solved the problem or can 32-bit Eclipse only produce 32-bit and not 64-bit?
That would seem to bring up another interesting question, although the other article answers this question too, that 64-bit Eclipse can build 64-bit and 32-bit Eclipse 32-bit, not mix and match like Visual Studio, even if you do set the libraries correctly. I will see.

I'm answering your "another interesting question".
In Eclipse there is a Feature called 'Delta Pack' which makes Eclipse able to export RCP applications into different platforms than the Eclipse you're looking at. It knows how to make 32/64 bits too.
But it has disadvantages:
1.) It's somewhat slow to export (a half minute maybe)
2.) You have to debug your application via Remote Java Application debugging (on localhost probably)
I'm not sure about the second point; I was fixing a UI bug which only appeared on Ubuntu exports so I had to debug it on a virtual-machine as a Remote app.

Related

Eclipse aarch64 and OpenJDK (ARM)

I'm trying out the Eclipse 4.20 builds available as Mac OSX (64 bit version for Arm64/AArch64) running under macOS 11 on Apple Silicon. This version doesn't seem to come with a jdk, so I've assumed I need to handle that myself. I installed 16.0.1-librca from Bellsoft with SDKman (Rosetta2 mode false).
I edited the info.plist file of Eclipse like this:
<key>Eclipse</key>
<array>
<string>-vm</string>
<string>~/.sdkman/candidates/java/16.0.1-librca/bin/java</string>
…(Other stuff here)
</array>
and Eclipse does indeed startup, but crashes right away. A while after this macOS claims I don't have the permissions to start the app. Results are identical with the Zulu AArch64.
I typically get
"Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes:
KERN_INVALID_ADDRESS at 0x000000000000000c"
and
"Application Specific Information: abort() called"
in libjvm.dylib.
This with some variations depending on the setup used.
Assuming these releases are supposed to work in macOS 11 on Apple Silicon, then it would seem likely this should be possible to get working. Or have I misunderstood the meaning of aarch64 here? Are these perhaps just versions for jdk developers? I looked over the "Target Environments" for Eclipse and feel unsure what other uses a version labelled as "Mac…for Arm64/AArch64" would have here.
libexec doesn't see the SDKman installed version. When I run java --version in the terminal it does show "openjdk 16.0.1 2021-04-20" and not my main Oracle JDK.
Any suggestions on how to set this up?
I have yet to investigate the actual reason, but after I had installed the "OpenJDK 64-Bit Server VM Zulu (build 11.0.11+9-LT)" and I had started to contemplate overriding eclipse.ini in order to avoid macOS preventing me from starting a modified app (recurrent issue. Note I didn't attempt overriding) I started Eclipse from the command line with the open command and Eclipse starts right up using
-vm
/Users/[user name]/.sdkman/candidates/java/11.0.11-zulu/zulu-11.jdk/Contents/Home/bin/`
At least this starts Eclipse. Double clicking the app renders the same results as before.
A theory is that since the open command runs in the terminal and java --version verifies the zulu jdk set there by sdkman, this is why. However JAVA_HOME is empty and the /usr/libexec/java_home -V command only lists the Oracle JDK.
Thank you #greg-449 and #howlger. I don't think I'd found this without your helpful suggestions.
To not have to be in the terminal just for starting Eclipse I made this little Applescript that opens Terminal (Just executing the command without it involved wouldn't supply the proper JVM):
on run {input, parameters}
tell application "Terminal"
activate
do script "open /Applications/Eclipse.app"
delay 1
close front window
end tell
Save that as an app and start with this instead of Eclipse.
If I could find out how the proper JVM in Terminal is supplied to Eclipse with the open command, maybe this can be used for modifying how Eclipse starts.

Android Studio failed to load JVM on Mac OSX (Mavericks)

I am trying to setup Android Studio on my Mac. It is running OSX 10.9.1 Mavericks. I have installed the latest JDK (at the time of writing 1.7 update 45), and I installed Android Studio. I use Java 7 because I have some Java applications I have to run and they require 1.7. I have not installed Java 1.6, because it is ancient and old. Launching Android Studio from any launcher does literally nothing. Activity Manager never shows it running. I do not want to install Java 1.6.
I did some work and tried to run the executable via command line through the package contents, and for both executables, I get these messages:
I am unsure what I am supposed to do to fix this error. I'm not very adept on a Mac (still somewhat new to it, and its confusing to do power user stuff on this) so if anyone can help me figure it out that'd be great. I'm on the 2013 Macbook Air with plenty of resources for this to run.
Update: This also applies to Yosemite, El Capitan, and all the other versions of OSX that can run Android Studio.
Update 12/11/2014
As of Android Studio 1.0 RC3 you can follow this set of directions to make it work.
I figured it out. You have to edit the android studio's Info.plist file in the package so it uses 1.7. I don't get why Android Studio insists we install and use an outdated, vulnerable version of Java.
Full resolution: http://i.stack.imgur.com/yyYaG.png
To open the package you need to find the Android Studio.app file in the Applications folder and right click it > Show Package Contents.
Edit the plist (I think you might need to be root) and change JVMVersion from 1.6* to 1.7* (or 1.8*, or whatever JDK major version you have). I don't get why that made a difference since my original output said it was using 1.7 anyways.
This fix seems to apply to all of IntelliJ's IDEs (I've seen it on PyCharm as well), though other ones seem to support newer versions of java natively.
As answered by hasternet # Android Studio was unable to find a valid Jvm (Related to MAC OS)
For quick and dirty solution, Follow the answer by Mgamerz; open Android Studio in Finder (CTRL+Click > Show Package Contests > Contents > info.plist) and edit Key JVMOptions>JVMVersion from "1.6*" to "1.6+"
Recommended method as discovered by Antonio Jose is to edit environment variables in MacOS (messing with info.plist is not recommended)
either at program launch (opening the Studio through terminal rather than the icon)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
or setting up the environment through AppleScript at every MacOS startup:
do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"
do shell script "launchctl setenv STUDIO_PROPERTIES /Users/username/Library/Preferences/AndroidStudio/idea.properties"
do shell script "launchctl setenv STUDIO_VM_OPTIONS /Users/username/Library/Preferences/AndroidStudio/studio.vmoptions"
(Remember to save the script as Application. Antonio Jose managed with just the first line - AFAIK you can use .properties and .vmoptions to set up additional settings.)
Official instructions: http://tools.android.com/tech-docs/configuration/osx-jdk
(The reason why Android Studio want's to run off of JRE 1.6 is because it apparently makes the fonts look better - feel free to go through that "official" route and install JRE 1.6 # http://support.apple.com/kb/DL1572 - you can then set the JDK to 1.8 in the SDK Location settings - local.properties)
mgamerz is right - The release notes give a much better solution for rc3 and onwards - theres a idea.properties file
(or environment variable)
~/Library/Preferences/AndroidStudio/idea.properties
it also shows what environment variables you can use to set things like the jdk
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
ref : http://tools.android.com/recent/androidstudio1rc3_releasecandidate3released
I did below command on Mac Terminal to fix this problem, please make sure java version and path.
$java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
Hey Friends I just Figured it out a simple way to fix this for Mac users.
Open Terminal and type this -> java -version and hit enter.
Output will be something like this:
Now check your Java Version. My Java version is 1.8
So now we need to Open Contents of our Android App.
For that right click the Android.app and then select Show Contents
Like this
Now there will be Content folder, Open that Folder and there you will find Info.plist
Open this info.plist
And you will see this.
In this expand the JVM
Here you will see the JVM version showing 1.6* but our jvm version is 1.8 (for example my jvm version is 1.8)
So we need to change this number according to our jvm version, so i changed it to version 1.8*
Then click save. And you are done.
Now you will see setup wizard running
And you are ready to start your first android programming app.
Here is the Whole Docx file for Android Studio Setup in Mac X
LINK: https://www.dropbox.com/s/9jwjebn5hgydyll/Android%20Studio%20Setup%20on%20Mac.docx?dl=0
I found that downloading an extra Java bundle from Apple fixed the issue.
If you search for this problem then I found the second link was to a blog having exactly this problem, all credit goes to him here
I know that posting links isn't an answer but as you can see from the resolution you need to make sure you have an up to date version of Java and also the Java bundle from Apple, for this reason I have also included the searches needed to get to these websites.
Here is where to download the latest version of Java
If this link is broken then searching "java latest version" return it at the top of the Google list
Here is where to download the Apple Bundle
If this link is broken then searching "Java for OS X 2014-001" returns it at the top of the Google list
For me trying to solve this problem it appears that initially it was an issue that required a work around and then Apple released an official work around download meaning that fiddling in plists is not necessary any more.

Can't load AMD 64-bit .dll on a IA 32-bit platform

I download the Gurobi package for linear programming. I import the corresponding gurobi.jar package. Then run the example program. Then it appears the following errors:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
C:\gurobi460\win64\win64\bin\GurobiJni46.dll: Can't load AMD 64-bit
.dll on a IA 32-bit platform
Then I downloaded the window 64 bit Jre, and use the "window-->preference-->Installed JRE" to install this new JRE.
However, it still appeared this error.
If you are still getting that error after installing the 64 bit JRE, it means that the JVM running Gurobi package is still using the 32 bit JRE.
Check that you have updated the PATH and JAVA_HOME globally and in the command shell that you are using. (Maybe you just need to exit and restart it.)
Check that your command shell runs the right version of Java by running "java -version" and checking that it says it is a 64bit JRE.
If you are launching the example via a wrapper script / batch file, make sure that the script is using the right JRE. Modify as required ...
If you are launching the example via an IDE, check that the IDE is using the right JRE to launch. Check and modify the IDE configs. The details will depend on the IDE you are using. Check the documentation. (Just setting external environment variables such as JAVA_HOME may not be sufficient in this case.)
Try this:
Download and install a 32-bit JDK.
Go to eclipse click on your project (Run As → Run Configurations...) under Java Application branch.
Go to the JRE tab and select Alternate JRE. Click on Installed JRE button, add your 32-bit JRE and select.
Uninstall(delete) this: jre, jdk, eclipse.
Download 32 bit(x86) version of this programs:jre, jdk, eclipse.
And install it.

How to reconfigure eclipse to use a 64 bit JVM

I'm using eclipse on what I thought were all 64 bit runtime environments. The current settings Java>installed JREs and Execution Environment all point to jdk1.6.0_30 which is a 64 bit version of the JDK. However, eclipse still thinks it's running a 32 bit version because when I run:
System.getProperty("sun.arch.data.model");
it returns 32 instead of 64.
And the external JNI resource that I compiled for 64 bit machines will not link to the shared .so file unless it's running in a 64 bit enviroment. (I'm getting word size mismatch errors when I try to do this)
So How can I reconfigure eclipse to run 64 bit jvm. Does eclipse itself have to be a 64 bit version?
:on linux
Edit: I have tried everyone's suggestions and nothing is working. I've changed the execution, and enviroment variables to point to the newst JDK I have which is 1.6_30. when I run the program from a command line I get 64 and amd64 as the value when I run the same program in eclise I get 32 and i386. Something is wrong in eclipse that is causing it to try and run it on a 32 bit JVM. when I try java -d32 -version it says that a 32 bit enviroment isn't installed but Eclipse doesn't know that. I've modified the Eclipse.ini file and still nothing is working. I've restarted eclipse after these changes...nothing. Can some one who knows eclipse well people help me out here. thanks
Add the -vm tag to eclipse.ini or the shortcut to explicitly specify a JRE. Note that the default for Windows XP is to use the CRAPPY JRE that comes with Windows.
-vm "%JAVA_HOME%/bin/javaw.exe"
In eclipse.ini add:
-Xmx8g
-d64
For me its working properly! . Make sure your path is c:\Program File not c:\Program File(X86) ( if you installed 64 bit JDK it should store in c:\ Program Files)
Eclipse configuration is explained here
The "installed JREs" (better use JDKs) are used for building and running your code and can be of different architecture or Java version. The JVM used for running Eclipse is defined in the eclipse.ini file. You should use the version for the architecture of the JVM.
Okay. This has been rather headache inducing, but I believe I have a solution. After changing the eclipse.ini, Go to your project properties. Under the Run/Debug settings, edit the launch configuration for your project. Under the JRE tag, click installed JREs. When that dialog comes up, click search. Go to your program files folder, NOT the x86 one, and let it search for your JREs. When the latest comes up, deselect the JRE that was currently selected and select the most recent JRE that it found. I renamed mine JRE7-64 just so I could identify a difference. This solved the issue on my end. Good luck
I think there is a bug in the Run Configuration page.
I had to add the 64-bit JRE in run configuration, select it, and DELETE the 32-bit entry (even though it was already deselected).
eclipse.ini didn't work for me.
This is Eclipse Luna.

Plugins not working in Eclipse on Windows 7 64-bit

On my brand new Windows 7 machine, I downloaded Eclipse (Galileo) and several Eclipse plugins (Android's ADT plugin, Subclipse, etc.)
After rebooting, neither of these plugins are showing up in the IDE (nothing in the preferences, menus, etc.) but if I click "Installation Details" in the 'About Eclipse' popup, I see all of the plugins listed as Installed Software. (ex. Android DDMS 0.9.5, Subclipse 1.6.5, etc.)
How do I get my plugins to work?
I installed the following:
jre-6u21-windows-x64.exe {you have to download it using IE-64bit} (C:\Program Files\Java\jre6)
android-sdk_r06-windows.zip (C:\Program Files\Java\android-sdk-windows)
eclipse-jee-helios-win32-x86_64.zip (C:\Program Files\Eclipse)
First time I tried, I had the same problem as above - no "Android SDK and AVD Manager" in Window menu, and no "Android" item in the Eclipse Window Preferences.
I uninstalled the ADT plugin and closed Eclipse. Then launched Eclipse in Administrator mode. Then I installed ADT, closed and reopened Eclipse as normal, and it worked :D
After mucking around for a while, I realized that when I copied the Eclipse directories to program files, I put them under the 64 bit directory, not the 32 bit (x86).. after moving eclipse to the new directory and reinstalling the plugin, it seems to work. Not sure if this is correlation or causation so maybe someone with more expertise can shed some light on this situation.
Moved the Eclipse to X86 and worked Thanks man that was getting annoying
I was getting this problem too. Installing Eclipse 64 bit into C:\Program Files\ and using a 64 bit JVM. For me the problem turned out to be the UAC (User Access Control). Once I turned this off via the control panel & restarted, I was able to install my plugins correctly.
No idea why Eclipse or Windows didn't prompt me in some way. Now to turn it back on after my plugins have installed.
An eclipse under Program Files (and not Program Files (x86)):
should be a 64-bit eclipse distro ("Windows (x86_64)")
meant to be used with a 64-bit JDK only.
Actually, you cannot download the 64-bit eclipse distro without having a warning specifying you need a 64-bit JVM:
This build requires a 64-bit JVM, and will not run with a 32-bit JVM.
You can, for example, use the Sun 64-bit 1.5 JVM for AMD64.
Note that the Sun 1.4.2 JVM for AMD64 is 32-bit and therefore cannot be used to run this build.
So: are you sure you have a 64-bit eclipse?
and what java -version returns? (Java HotSpot(TM) 64-Bit Server VM?)
First check the Window -> Preferences -> Android exists or not.
If exists, just point the SDK Location to your android sdk location.
If something missing, just Window -> Android SDK And AVD Manager to download all the sdk you needed.
p.s. Just download the new 64bit jdk from sun, file named jdk-6u17-windows-x64.exe.
C:\Program Files\eclipse -> right click -> Properties -> Security -> Edit -> Add... -> your username -> Full Control -> Apply
While running Eclipse as administrator does work, I found that doing the above to give yourself and normal Eclipse full write access to the folder is far better since you only have to do it once.
I had the same problem and resolved it installing Eclipse in an own, user-defined directory, but NOT inside any of those system-managed "C:\Program Files"-directories.

Categories