How to see JIT-compiled code in JVM? - java

Is there some way to see the native code produces by the JIT in a JVM?

General usage
As explained by other answers, you can run with the following JVM options:
-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
Filter on a specific method
You can also filter on a specific method with the following syntax:
-XX:+UnlockDiagnosticVMOptions -XX:CompileCommand=print,*MyClass.myMethod
Notes:
you might need to put the second argument within quotes depending on OS etc.
if the method gets inlined, you could miss some optimisations
How to: Install the required libraries on Windows
If you are running Windows, this page has instructions on how to build and install hsdis-amd64.dll and hsdis-i386.dll which are required to make it work. We copy below and extend the content of that page* for reference:
Where to get prebuilt binaries
You can download prebuilt binaries for Windows from the fcml project
hsdis-amd64.dll
hsdis-i386.dll
How to build hsdis-amd64.dll and hsdis-i386.dll on Windows
This version of the guide was prepared on Windows 8.1 64bit using 64-bit Cygwin and producing hsdis-amd64.dll
Install Cygwin. At the Select Packages screen, add the following packages (by expanding the Devel category, then clicking once on the Skip label next to each package name):
make
mingw64-x86_64-gcc-core (only needed for hsdis-amd64.dll)
mingw64-i686-gcc-core (only needed for hsdis-i386.dll)
diffutils (in Utils category)
Run the Cygwin Terminal. This can be done using the Desktop or Start Menu icon created by the installer, and will create your Cygwin home directory (C:\cygwin\home\<username>\ or C:\cygwin64\home\<username>\ by default).
Download the latest GNU binutils source package and extract its contents to your Cygwin home directory. At the time of writing, the latest package is binutils-2.25.tar.bz2. This should result in a directory named binutils-2.25 (or whatever the latest version is) in your Cygwin home directory.
Download the OpenJDK source by going to the JDK 8 Updates repository, selecting the tag corresponding to your installed JRE version, and clicking bz2. Extract the hsdis directory (found in src\share\tools) to your Cygwin home directory.
In the Cygwin Terminal, enter cd ~/hsdis.
To build hsdis-amd64.dll, enter
make OS=Linux MINGW=x86_64-w64-mingw32 'AR=$(MINGW)-ar' BINUTILS=~/binutils-2.25
To build hsdis-i386.dll, enter
make OS=Linux MINGW=i686-w64-mingw32 'AR=$(MINGW)-ar' BINUTILS=~/binutils-2.25
In either case, replace 2.25 with the binutils version you downloaded. OS=Linux is necessary because, although Cygwin is a Linux-like environment, the hsdis makefile fails to recognize it as such.
The build will fail with messages ./chew: No such file or directory and gcc: command not found. Edit <Cygwin home directory>\hsdis\build\Linux-amd64\bfd\Makefile in a text editor like Wordpad or Notepad++ to change SUBDIRS = doc po (line 342, if using binutils 2.25) to SUBDIRS = po. Re-run the previous command.
The DLL can now be installed by copying it from hsdis\build\Linux-amd64 or hsdis\build\Linux-i586 to your JRE's bin\server or bin\client directory. You can find all such directories on your system by searching for java.dll.
Bonus tip: if you prefer Intel ASM syntax to AT&T, specify -XX:PrintAssemblyOptions=intel alongside any other PrintAssembly options you use.
*page license is Creative Commons

Assuming you're using the Sun Hotspot JVM (i.e. the one provided on java.com by Oracle), you can add the flag
-XX:+PrintOptoAssembly
when running your code. This will print out the optimized code generated by the JIT compiler and leaves out the rest.
If you want see the entire bytecode, including the unoptimized parts, add
-XX:CompileThreshold=#
when you're running your code.
You can read more about this command and the functionality of JIT in general here.

You need an hsdis plugin to use PrintAssembly. A convenient choice is the hsdis plugin based on FCML library.
It can be compiled for UNIX-like systems and on Windows you can use pre-built libraries available in the FCML download section on Sourceforge:
To install in Windows:
Extract the dll (it can be found in hsdis-1.1.2-win32-i386.zip and hsdis-1.1.2-win32-amd64.zip).
Copy the dll to wherever exists java.dll (use Windows search). On my system, I found it at two locations:
C:\Program Files\Java\jre1.8.0_45\bin\server
C:\Program Files\Java\jdk1.8.0_45\jre\bin\server
To install in Linux:
Download source code, extract it
cd <source code dir>
./configure && make && sudo make install
cd example/hsdis && make && sudo make install
sudo ln -s /usr/local/lib/libhsdis.so <JDK PATH>/lib/amd64/hsdis-amd64.so
sudo ln -s /usr/local/lib/libhsdis.so <JDK PATH>/jre/lib/amd64/hsdis-amd64.so
On my system, the JDK is in /usr/lib/jvm/java-8-oracle
How to run it:
java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
-XX:+LogCompilation -XX:PrintAssemblyOptions=intel,mpad=10,cpad=10,code
-jar fcml-test.jar
Additional configuration parameters:
code Print machine code before the mnemonic.
intel Use the Intel syntax.
gas Use the AT&T assembler syntax (GNU assembler compatible).
dec Prints IMM and displacement as decimal values.
mpad=XX Padding for the mnemonic part of the instruction.
cpad=XX Padding for the machine code.
seg Shows the default segment registers.
zeros Show leading zeros in case of HEX literals.
The Intel syntax is a default one in case of Windows, whereas the AT&T one is a default for the GNU/Linux.
For more details see the FCML Library Reference Manual

For the HotSpot (was Sun) JVM, even in product modes:
http://wikis.oracle.com/display/HotSpotInternals/PrintAssembly
Some assembly required: it needs a plugin.

I believe WinDbg would be helpful if you are running it on windows machine.
I have just run one jar.
Then I attached to the java process
through Windbg
Examined threads by ~ command; There were 11 threads, 0 thread was main worker thread
Switched to 0-thread - ~0s
Looked through unmanmaged callstack by kb there was:
0008fba8 7c90e9c0 ntdll!KiFastSystemCallRet
0008fbac 7c8025cb ntdll!ZwWaitForSingleObject+0xc
0008fc10 7c802532 kernel32!WaitForSingleObjectEx+0xa8
0008fc24 00403a13 kernel32!WaitForSingleObject+0x12
0008fc40 00402f68 java+0x3a13
0008fee4 004087b8 java+0x2f68
0008ffc0 7c816fd7 java+0x87b8
0008fff0 00000000 kernel32!BaseProcessStart+0x23
Highlighted lines is direct running JIT-ed code on JVM.
Then we can look for method address:
java+0x2f68 is 00402f68
On WinDBG: Click View -->
Disassembly. Click Edit --> Go to
Address. Put 00402f68 there
and got
00402f68 55 push ebp
00402f69 8bec mov ebp,esp
00402f6b 81ec80020000 sub esp,280h
00402f71 53 push ebx
00402f72 56 push esi
00402f73 57 push edi
... and so on
For additional info here is the Example how to trace back JIT-ed code from memory dumps using process explorer and WinDbg.

Another way to see machine code and some performance data is to use AMD's CodeAnalyst or OProfile, which have a Java plugin to visualize executing Java code as machine code.

Print the assembly of your hotspots with JMH's perfasm profilers (LinuxPerfAsmProfiler or WinPerfAsmProfiler). JMH does require the hsdis library since it relies on PrintAssembly.

Related

Weblogic Installer will not hook the Java Virtual Machine to load the installer

Getting the following error when attempting to load the Oracle Weblogic installer:
tsugonko-1: ~/weblogic
→ java -jar fmw_12.2.1.4.0_wls_quick.jar
Launcher log file is /private/var/folders/jk/jjhksz9n6c354s25_pvj9qp80000gn/T/OraInstall2022-01-13_11-44-45AM/launcher2022-01-13_11-44-45AM.log.
Extracting the installer . . . . Done
Checking if CPU speed is above 300 MHz. Actual 2662.4 MHz Passed
Checking swap space: must be greater than 512 MB. Actual 145636 MB Passed
Checking if this platform requires a 64-bit JVM. Actual 64 Passed
Checking temp space: must be greater than 300 MB. Actual 145636 MB Passed
Preparing to launch the Oracle Universal Installer from /private/var/folders/jk/jjhksz9n6c354s25_pvj9qp80000gn/T/OraInstall2022-01-13_11-44-45AM
Unrecognized option: -d64
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
1. First, I have verified that the installer script is present, but don't know how to verify that it is actually loading:
tsugonko-1: /private/var/folders/jk/jjhksz9n6c354s25_pvj9qp80000gn/T/OraInstall2022-01-13_11-44-45AM
→ ls
OPatch launcher2022-01-13_11-44-45AM.log oui
install13817544693051062390.sh oracle_common
2. I believe my $JAVE_HOME path is correct:
→ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home
→ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home/bin
(notice that "bin" is not included in the /usr/libexec path, I removed the /bin from the $JAVA_HOME path, but that did not correct the issue)
3. And I believe I have correctly listed the PATH in the ~/.bash_profile (Mac OS, no .bashrc, amended file output to the actual PATH variable
tsugonko-1: /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home/bin
→ cat ~/.bash_profile
#!/usr/bin/env bash
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home/bin
export PATH=/Library/Java/JavaVirtualMachines/jdk-16.jdk/Contents/Home/bin:$PATH
export ORACLE_HOME=~/Applications/Oracle
(Notice I have two variable paths, I commented one out then the other, but this did not correct the issue either), internet search suggested both, but I assume one is best practice)
Any suggestions from the group? Incidentally, I did have weblogic server installer, but it got corrupted: I could load the admin server, but not any managed servers, so I deleted the files (rm -rf weblogic).
Is it possible I did not properly uninstall weblogic and there is a zombied process preventing the installer to hook the JVM or otherwise not load?
WebLogic Server 12.2.1.4 does not support java 16 but only java 8 and java 11.
Also, it is only supported with Oracle JDK and not OpenJDK.

JAVA_HOME is not set. (RuntimeError) while installing rjb gem for ruby in WSL

I am trying to install the gem rjb and I have come across this error
extconf.rb:53:in <main>': JAVA_HOME is not set. (RuntimeError).
The following is the entire error log.
$sudo gem install rjb -v '1.4.9' --source 'https://rubygems.org/'
[sudo] password for santoshpavan:
Building native extensions. This could take a while...
ERROR: Error installing rjb:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/rjb-1.4.9/ext
/usr/bin/ruby2.5 -r ./siteconf20200411-19244-10jhs3k.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
extconf.rb:53:in `<main>': JAVA_HOME is not set. (RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/rjb-1.4.9 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/rjb-1.4.9/gem_make.out
I tried the answer that is mentioned here.
When I printed the env I can see the JAVA_HOME path mentioned, as below.
santoshpavan#DESKTOP-ISVIQCL:/mnt/c/code/expertiza$ env
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
HOSTTYPE=x86_64
LESSCLOSE=/usr/bin/lesspipe %s %s
LANG=C.UTF-8
OLDPWD=/mnt/c
WSL_DISTRO_NAME=Ubuntu-18.04
JAVA_HOME=/mnt/c/Program Files/Java/jdk-10.0.2
S_COLORS=auto
USER=santoshpavan
RBENV_SHELL=bash
PWD=/mnt/c/code/expertiza
HOME=/home/santoshpavan
NAME=DESKTOP-ISVIQCL
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
SHELL=/bin/bash
TERM=xterm-256color
SHLVL=1
LOGNAME=santoshpavan
PATH=/home/santoshpavan/.yarn/bin:/home/santoshpavan/.config/yarn/global/node_modules/.bin:/home/santoshpavan/.rbenv/plugins/ruby-build/bin:/home/santoshpavan/.rbenv/shims:/home/santoshpavan/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_2020.1804.7.0_x64__79rhkp1fndgsc:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Python27/:/mnt/c/Python27/Scripts:/mnt/c/Users/santo/AppData/Local/Programs/Python/Python37-32/Scripts/:/mnt/c/Users/santo/AppData/Local/Programs/Python/Python37-32/:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/libnvvp:/mnt/c/app/santo/product/12.1.0/dbhome_1/bin:/mnt/c/Program Files/Java/jdk-10.0.2/bin:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2019.4.0/:/mnt/c/Apache/apache-zookeeper-3.5.6-bin/bin:/mnt/c/Program Files/Java/jdk-10.0.2/bin:/mnt/c/Spark/spark-3.0.0-preview2-bin-hadoop2.7:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/PostgreSQL/12/bin:/mnt/c/Program Files/PostgreSQL/12/lib:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Users/santo/.cargo/bin:/mnt/c/Ruby27-x64/bin:/mnt/c/Program Files/Git/usr/local/bin:/mnt/c/Program Files/Git/bin:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS/:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS/:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/WINDOWS/System3:/mnt/c/Program Files/JetBrains/PyCharm Community Edition 2019.3.4/bin:/snap/bin
WSLENV=JAVA_HOME/p
LESSOPEN=| /usr/bin/lesspipe %s
_=/usr/bin/env
I do no understand the issue here as JAVA_HOME is present in the environment variables with the WSLENV.
Note:
Earlier, when I had the same error, following this helped. But the javac was still was not being detected. So, I installed java in wsl using $ sudo apt install default-jdk. And, after that this issue has happened.
TL;DR: In WSL, you must use javac.exe since it is a Windows binary. Simply typing javac will not work, even if the path is set up correctly. If that doesn't work, try adding ../bin to the end of your JAVA_HOME variable.
Using Windows Binaries & Environment Variables in WSL
If you have JavaSDK installed on Windows, you do not need to install Linux binaries. Simply ensure that they are properly linked so WSL knows where to find the SDK.
Also, when calling a Windows binary from WSL, you cannot type javac, you must type javac.exe so WSL knows we're looking in the Windows file system.
Ensure Java for Windows works
Open PowerShell or cmd.exe from any directory and type java --version
You should get a list of JRK info:
openjdk 11.0.4 2019-07-16 LTS
OpenJDK Runtime Environment Corretto-11.0.4.11.1 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.4.11.1 (build 11.0.4+11-LTS, mixed mode)
Your version might be different, the important part is that the system knows where to find Java. If you get an error, ensure your Windows Environment variables are set correctly:
JAVA_HOME as an Environment Variable, and
JAVA_HOME/bin as a Path variable.
Setting Variable in WSL
The best place to put the next lines of code are in your .bashrc file (I have mine right before sourcing my aliases & functions), but if you are running multiple users or simply prefer ./bash_profile or /etc/profile put it there.
# Shared environment variables
export JAVA_HOME=/mnt/d/Java/jdk11.0.4_10
While we're at it, add any other Environment Variables you will need in your development setup.
I have my WSL, Java, and all my other dev tools set up on my second HDD which is not a system drive, ensure that your location matches your JAVA_HOME path in Windows.
If JavaSDK is located at: C:\Java\jdk8.0
The corresponding WSL mount point is: /mnt/c/Java/jdk8.0
Executing
Important: Use java.exe <args> in WSL instead of java <args>
Say you just wrote CompareTwoStrings.class and want to compile and run it using the Windows binaries. You can do it from a Windows shell or WSL.
From Windows Shell:
javac GetStringLength.java
java GetStringLength
From WSL:
javac.exe GetStringLength.java
java.exe GetStringLength
Using java <args> in WSL will result in a Command 'java' not found error. That is because running windows binaries from within WSL requires that the .exe extension is used in the command.
Simplicity
We don't want to install a second copy of Java specific to WSL and waste that precious disk space, so we're going to call the Windows binary from the WSL shell. This is a great benefit of WSL (WSL1 in particular) in that it can interact (almost) flawlessly with the Windows File System.
NOTE: In order to run a program, it must either be a Path variable, or be run from within it's containing folder.
Hopefully that works as easily for you as it did for me. Just remember to use the correct command depending on what OS binary you're running. This took me about 10 minutes to get set up, and has been a lifesaver for cross-compiling and general ease-of-use.

Difference between server JRE and client JRE [duplicate]

This question already has answers here:
Real differences between "java -server" and "java -client"?
(11 answers)
Closed 6 years ago.
I was going through server jre, when i extracted serverjre tar.gz , it gave me jdk folder. why does serverJRE gives JDK like folder. There is JRE folder inside serverJRE also. So which one to use, whole serverJRE or just JRE folder which is inside serverJRE. Also contents of JRE inside serverJRE is same as JRE inside JDK.
I am not understanding the difference.
Server JRE: It is used to deploy long-running java applications on server. It provides the fastest possible operating speed. It has been specifically fine tuned to maximize peak operating speed. It has highly aggressive algorithms to optimize the runtime performance of java application. It also includes variety of monitoring tools.
Client JRE: It is used to run java applications on the end-users systems. It contains everything to run the java applications. It can start up faster and requires a smaller memory footprint.
From Oracle's page.
The Server JRE includes tools for JVM monitoring and tools commonly
required for server applications, but does not include browser
integration (the Java plug-in).
So the difference is incredibly small. This would also mean that the difference between Server JRE and the JDK seems to be mainly that the JDK has a compiler. I didn't even realize that they have made the JREs into separate products, but over the years I can't remember anyone ever suggesting the Client JRE to anyone.
Considering that Applets are all but dead, I don't see any good reason to download the Client JRE. Then again I'm not in the business for desktop Java, so who knows.
I don't think people understood where the OP was coming from and I just ran into this. What follows is some detailed context.
As of the latest quarterly updates the root level directory inside the server jre gzipped tar ball inside of "p22187044_17095_Linux-x86-64.zip" is "jdk1.7.0_95"
IMO, this is sloppy on Oracle's part. In the case where you need to work with both and attempt to extract each in the same directory, you will be extracting both into the same directory.
$ unzip p22187044_17095_Linux-x86-64.zip server-jre-7u95-linux-x64.tar.gz
$ tar xzvf server-jre-7u95-linux-x64.tar.gz
# Extracted files with top-level directory: "jdk1.7.0_95"
# This polluted my previously extracted JDK (See differences below).
# Get a clean JDK 7 again:
$ rm -rf jdk1.7.0_95/
$ tar xzvf jdk-7u95-linux-x64.tar.gz
# Try again with the JRE; this time creating a container directory for the tar extraction:
$ mkdir jre1.7.0_95 && tar xzvf server-jre-7u95-linux-x64.tar.gz -C jre1.7.0_95/
# Directory "jre1.7.0_95/" contains top-level directory "jdk1.7.0_95"
# Let's look at the differences:
$ diff -qr jdk1.7.0_95 jre1.7.0_95/jdk1.7.0_95/
Only in jdk1.7.0_95/bin: ControlPanel
Only in jdk1.7.0_95/bin: javaws
Only in jdk1.7.0_95/bin: jcontrol
Only in jdk1.7.0_95/bin: jmc
Only in jdk1.7.0_95/bin: jmc.ini
Only in jdk1.7.0_95/jre/bin: ControlPanel
Only in jdk1.7.0_95/jre/bin: java_vm
Only in jdk1.7.0_95/jre/bin: javaws
Only in jdk1.7.0_95/jre/bin: jcontrol
Only in jdk1.7.0_95/jre/lib/amd64: libdeploy.so
Only in jdk1.7.0_95/jre/lib/amd64: libjavaplugin_jni.so
Only in jdk1.7.0_95/jre/lib/amd64: libnpjp2.so
Files jdk1.7.0_95/jre/lib/charsets.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/charsets.jar differ
Only in jdk1.7.0_95/jre/lib: deploy
Only in jdk1.7.0_95/jre/lib: deploy.jar
Only in jdk1.7.0_95/jre/lib: desktop
Files jdk1.7.0_95/jre/lib/ext/localedata.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/ext/localedata.jar differ
Only in jdk1.7.0_95/jre/lib/images: icons
Only in jdk1.7.0_95/jre/lib: javaws.jar
Files jdk1.7.0_95/jre/lib/jfxrt.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/jfxrt.jar differ
Files jdk1.7.0_95/jre/lib/jsse.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/jsse.jar differ
Only in jdk1.7.0_95/jre/lib: locale
Only in jdk1.7.0_95/jre/lib: plugin.jar
Files jdk1.7.0_95/jre/lib/rt.jar and jre1.7.0_95/jdk1.7.0_95/jre/lib/rt.jar differ
Only in jdk1.7.0_95/jre/lib/security: javaws.policy
Only in jdk1.7.0_95/jre: plugin
Only in jdk1.7.0_95/lib: missioncontrol
Files jdk1.7.0_95/lib/tools.jar and jre1.7.0_95/jdk1.7.0_95/lib/tools.jar differ
Only in jdk1.7.0_95/man/ja/man1: javaws.1
Only in jdk1.7.0_95/man/ja_JP.UTF-8/man1: javaws.1
Only in jdk1.7.0_95/man/man1: javaws.1
# And the size of each:
$ du -sh jdk1.7.0_95/ jre1.7.0_95/jdk1.7.0_95/
301M jdk1.7.0_95/
235M jre1.7.0_95/jdk1.7.0_95/
In the end it really depends on your application as to which you should use. For vendor apps. I typically refer to their recommendations. If there are none, I use the JDK simply because it includes more "stuff" which I don't want to find out is needed at some later date as there is no easy way to exercise all use cases of an interactive app.

CMake can't find Java because of Cygwin

A user of my software is running Windows with Cygwin installed, which provides access to the standard GNU which command. In my CMakeLists.txt there is a line that reads:
FIND_PACKAGE( JAVA REQUIRED CONFIG )
This fails on his machine, because both JAVAConfig.cmake and java-config.cmake (executed by FIND_PACKAGE) use this command as a first-line attack in locating Java. The command returns a bad path to a non-existent install of Java. What can I do to override this annoying behavior from my CMakeLists.txt?
Ask him to send you his "path" env. variable, you will find something interesting there for sure.
Other issue is Java installations.
Ask him to unstall old javas or just update to newest, current installer removes older copies.

Running a project with shell commands

I need to open a project which I think it is written in linux or need linux env for building it.
I use Win8 and I'mnot familiar with Linux env anymore.
Iin it's README file, it is written s.th like this:
HOW TO INSTALL
> tar xzvf DepOE-beta.tar.gz
> sh install-DepOE.sh
Two NLP tools are installed:
- DepPattern (dependency-based parser)
- Tree-Tagger (PoS tagger)
Pay attention: do not install the package in a directory whose name contain blank spaces!
HOW TO USE
depOE.sh <tagger> <lang> <file> [parser]
tagger=freeling, treetagger
language=gl, es, en, pt, fr
file=path of the input file
I opened it by Eclipse env which is integrated with Perl. but I couldnt open it.
what should I do??
please help me:(
since the usage file specifically says that you need to run
depOE.sh <tagger> <lang> <file> [parser]
I believe you will need some sort of UNIX shell to make it work. Moreover from the file tree you posted I believe you will also need a running Perl implementation on your machine. Please refer to http://slu.livejournal.com/17395.html for a tutorial on how to install Cygwin and Perl for Windows. Cygwin should give you some basic Linux/Unix/GNU tools for Windows environments and Perl obviously is a Perl interpreter for Windows.
However, I believe in your case the option to run a real Linux operating system in a virtual environment (if you want to keep your Windows installation untouched) is the best way to go. The fastest way (and a free option) would be to download VirtualBox from https://www.virtualbox.org and a Linux VM for instance with Ubuntu preinstalled from here http://virtualboxes.org/images/ubuntu/.

Categories

Resources