Showing posts with label JDK. Show all posts
Showing posts with label JDK. Show all posts

Tuesday, May 8, 2018

Run Eclipse Neon macOS on any Java JDK version

Starting Eclipse Neon 3 on macOS High Sierra using JDK 10 produces the following error during startup:

View Eclipse error log
$ vi ~/Documents/workspace/.metadata/.log

!SESSION 2018-05-09 08:09:01.603 -----------------------------------------------
eclipse.buildId=4.6.3.M20170301-0400
java.version=10.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -keyring /Users/xxxx/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -keyring /Users/xxxx/.eclipse_keyring

!ENTRY org.eclipse.osgi 4 0 2018-05-09 08:09:05.117
!MESSAGE Application error
!STACK 1
org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:386)
        at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:294)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)

        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultH

Get full path list of available Java Runtimes
$ /usr/libexec/java_home --verbose
Matching Java Virtual Machines (2):
    10.0.1, x86_64: "Java SE 10.0.1" /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
    1.8.0_172, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home


Edit eclipse .ini
$ vi /Applications/Eclipse.app/Contents/Eclipse/eclipse.ini

Add the following to the start of the line, replace with appropriate java version
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/bin

Monday, March 24, 2014

Install Java JDK on Windows using Non-Administrative User credentials

1. Download Java JDK e.g. jdk-7u55-windows-i586.exe
2. Extract downloaded .exe file using 7-zip
3. A tools.zip will be extracted and extract again using 7-zip
4. Open Command Prompt and locate the directory of the extracted file
5. From there executive the following command:
for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar"
6. Copy whole directory and all subdir of the extracted files e.g. c:\JDK
7. Setup JAVA environment via either of the following:
  • Right click My Computer -> Properties -> Advanced System settings -> Advanced -> Environment Variables. Add JAVA_HOME = c:\JDK. Add to Path = %JAVA_HOME%\bin
  • Create .bat file with following contents and execute when needed:
    • JAVA_HOME=C:\JDK
    • PATH=%PATH%;%JAVA_HOME%\bin