Results 1 to 9 of 9

Thread: assign default java for TOS

  1. #1
    Join Date
    Apr 2012
    Location
    Philippines
    Posts
    218

    Default assign default java for TOS

    Hello,

    Just setting up my new pc and trying to get the trading platform
    Thinkorswim working. After running the installation, here is the error I
    get:

    Code:
    Thinkorswim requires exactly Java 7, but found Java 8. Please set Oracle
    Java 7 as default java for thinkorswim. Java must include JavaFX and
    Oracel Java 7 has it, but OpenJDK 7 has not. Application will exit now.
    Now when I did a zypper search, I found that I have the following installed:
    Code:
    # zypper se openjdk
    Loading repository data...
    Reading installed packages...
    
    S | Name                                  | Summary
    | Type
    --+---------------------------------------+--------------------------------------------------------------+-----------
    i | java-1_7_0-openjdk                    | Java runtime environment
    based on OpenJDK 7 and IcedTea 7    | package
    i | java-1_7_0-openjdk-headless           | JRE based on OpenJDK 7 and
    IcedTea 7 without X, audio and -> | package
    | java-1_7_0-openjdk-javadoc            | Documentation of the Java
    API of OpenJDK 7                   | package
    i | java-1_7_0-openjdk-plugin             | Java Web Start and plugin
    implementation                     | package
    i | java-1_8_0-openjdk                    | OpenJDK Runtime Environment
    | package
    i | java-1_8_0-openjdk-headless           | OpenJDK Runtime Environment
    | package
    i | java-1_8_0-openjdk-plugin             | Java Web Start and plugin
    implementation                     | package
    (I deleted the extra entries and only showed what was installed above)

    My understanding of openjdk is that it contains more than the JRE, and
    actually has the compilers and debuggers for developing applications. I
    am not trying to develop applications, but just to run one, so the JDK
    should be overkill compared to just having the JRE.

    Now since I already have openJDK 7 and openJDK 8 both on my computer, I
    should be able to just somehow point thinkorswim to run openJDK 7
    instead of 8, right? But I have no idea how to do that. Any ideas?


    --
    G.O.
    Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
    Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
    Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB

  2. #2

    Default Re: assign default java for TOS

    Hi,
    just start your application with the right java.

    Normally, for openjdk 1.7 this should lie in:

    /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/bin/

    So

    Code:
    /usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/bin/java -jar yourprog.jar
    should do the trick.

    HTH

    Lenwolf

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,143
    Blog Entries
    2

    Default Re: assign default java for TOS

    I created scripts that will install Oracle Java 7 in a few seconds
    https://github.com/putztzu/openSUSE_Oracle_Java_Install

    As described, use the link to download the Oracle Java 7 rpm.
    Then, run the scripts in order.

    After you've installed Oracle Java 7, you need to run the "update-alternatives" utility to specify which Java you want to use, this utility allows you to have multiple JRE and JDK installed on a system and easily switch between them.

    Have fun,
    TSU

  4. #4
    Join Date
    Apr 2012
    Location
    Philippines
    Posts
    218

    Default Re: assign default java for TOS

    On 02/13/2015 10:46 AM, tsu2 wrote:
    >
    > I created scripts that will install Oracle Java 7 in a few seconds
    > https://github.com/putztzu/openSUSE_Oracle_Java_Install
    >
    > As described, use the link to download the Oracle Java 7 rpm.
    > Then, run the scripts in order.
    >
    > After you've installed Oracle Java 7, you need to run the
    > "update-alternatives" utility to specify which Java you want to use,
    > this utility allows you to have multiple JRE and JDK installed on a
    > system and easily switch between them.
    >
    > Have fun,
    > TSU
    >
    >

    Ok, great. I downloaded the Oracle Java 7 rpm and installed it. Here is
    the result:
    Code:
    # zypper in jdk-7u75-linux-x64.rpm
    Loading repository data...
    Reading installed packages...
    Resolving package dependencies...
    
    The following NEW package is going to be installed:
    jdk
    
    1 new package to install.
    Overall download size: 120.8 MiB. Already cached: 0 B  After the
    operation, additional 197.3 MiB will be used.
    Continue? [y/n/? shows all options] (y): y
    Retrieving package jdk-2000:1.7.0_75-fcs.x86_64
    (1/1), 120.8 MiB (197.3 MiB unpacked)
    Checking for file conflicts:
    ...................................................................................[done]
    (1/1) Installing: jdk-2000:1.7.0_75-fcs
    ........................................................................[done]
    Additional rpm output:
    Unpacking JAR files...
    rt.jar...
    jsse.jar...
    charsets.jar...
    tools.jar...
    localedata.jar...
    jfxrt.jar...
    However, I have not been able to figure out how to execute these scripts:

    Code:
    # ./rt.jar
    bash: ./rt.jar: No such file or directory
    # java rt.jar
    Error: Could not find or load main class rt.jar
    So how do I execute these scripts?

    I have not yet gone through the sdb on this page
    https://en.opensuse.org/SDB:Installing_Java, because I was under the
    impression that if I run those scripts in the package you wrote, it
    takes care of everything. I hope I am understanding this right.

    Thanks for your help.

    --
    G.O.
    Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
    Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
    Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB

  5. #5
    Join Date
    Apr 2012
    Location
    Philippines
    Posts
    218

    Default Re: assign default java for TOS

    On 02/13/2015 10:46 AM, tsu2 wrote:
    >
    > I created scripts that will install Oracle Java 7 in a few seconds
    > https://github.com/putztzu/openSUSE_Oracle_Java_Install
    >
    > As described, use the link to download the Oracle Java 7 rpm.
    > Then, run the scripts in order.
    >
    > After you've installed Oracle Java 7, you need to run the
    > "update-alternatives" utility to specify which Java you want to use,
    > this utility allows you to have multiple JRE and JDK installed on a
    > system and easily switch between them.
    >
    > Have fun,
    > TSU
    >
    >

    Nevermind my last post, I figured it out. I couldn't find where the
    scripts were downloaded to, but they were downloaded into
    "openSUSE_Oracle_Java_Install" which was put in my home directory.

    I did run into a hitch when running the install scripts - script 1 and 2
    were written with jdk1.7.0_67 in mind, and I had to switch them to
    jdk1.7.0_75, which was the lastest java 7 version that I had downloaded.
    Since I didn't do that in the first place, I had to go back into the
    directories in /usr/... and delete some improperly placed links, and
    then run the scripts again. Once all the scripts showed that they
    executed correctly, the system was installed correctly.

    In order to run TOS, I had to do the following command:
    Code:
    # update-alternatives --config java
    There are 3 choices for the alternative java (providing /usr/bin/java).
    
    Selection    Path                                       Priority   Status
    ------------------------------------------------------------
    * 0            /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java   18040
    auto mode
    1            /usr/lib64/jdk_Oracle/bin/java              3
    manual mode
    2            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java   17147
    manual mode
    3            /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java   18040
    manual mode
    
    Press enter to keep the current choice[*], or type selection number: 1
    update-alternatives: using /usr/lib64/jdk_Oracle/bin/java to provide
    /usr/bin/java (java) in manual mode
    So I have set it in manual mode to java 7, and I can run TOS.

    But now the question is, if I normally want to be running java 8 (in
    order to have the latest version with all the security patches), do I
    need to run the update-alternatives every time I get in and out of TOS?
    Right now I am thinking of creating another script that will run this so
    I can select it, but I am wondering if there is an easier way.

    --
    G.O.
    Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
    Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
    Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,143
    Blog Entries
    2

    Default Re: assign default java for TOS

    Quote Originally Posted by golson765 View Post
    On 02/13/2015 10:46 AM, tsu2 wrote:
    >
    > I created scripts that will install Oracle Java 7 in a few seconds
    > https://github.com/putztzu/openSUSE_Oracle_Java_Install
    >
    > As described, use the link to download the Oracle Java 7 rpm.
    > Then, run the scripts in order.
    >
    > After you've installed Oracle Java 7, you need to run the
    > "update-alternatives" utility to specify which Java you want to use,
    > this utility allows you to have multiple JRE and JDK installed on a
    > system and easily switch between them.
    >
    > Have fun,
    > TSU
    >
    >

    Nevermind my last post, I figured it out. I couldn't find where the
    scripts were downloaded to, but they were downloaded into
    "openSUSE_Oracle_Java_Install" which was put in my home directory.

    I did run into a hitch when running the install scripts - script 1 and 2
    were written with jdk1.7.0_67 in mind, and I had to switch them to
    jdk1.7.0_75, which was the lastest java 7 version that I had downloaded.
    Since I didn't do that in the first place, I had to go back into the
    directories in /usr/... and delete some improperly placed links, and
    then run the scripts again. Once all the scripts showed that they
    executed correctly, the system was installed correctly.

    In order to run TOS, I had to do the following command:
    Code:
    # update-alternatives --config java
    There are 3 choices for the alternative java (providing /usr/bin/java).
    
    Selection    Path                                       Priority   Status
    ------------------------------------------------------------
    * 0            /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java   18040
    auto mode
    1            /usr/lib64/jdk_Oracle/bin/java              3
    manual mode
    2            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java   17147
    manual mode
    3            /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java   18040
    manual mode
    
    Press enter to keep the current choice[*], or type selection number: 1
    update-alternatives: using /usr/lib64/jdk_Oracle/bin/java to provide
    /usr/bin/java (java) in manual mode
    So I have set it in manual mode to java 7, and I can run TOS.

    But now the question is, if I normally want to be running java 8 (in
    order to have the latest version with all the security patches), do I
    need to run the update-alternatives every time I get in and out of TOS?
    Right now I am thinking of creating another script that will run this so
    I can select it, but I am wondering if there is an easier way.

    --
    G.O.
    Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
    Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
    Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB
    Good that you figured out the modification for the specific JDK version.
    I need to update the scripts each time Oracle releases a new minor version.

    I recommend you just switch to JDK 7 whenever you need to, or leave that as the default since even today most Java apps don't require JDK 8... yet.

    In other words, switch your entire system as needed.
    It gets a little trickier to assign the Java HOME variable to specific apps and may not be possible using update-alternatives.

    TSU

  7. #7
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,143
    Blog Entries
    2

    Default Re: assign default java for TOS

    Quote Originally Posted by golson765 View Post
    My understanding of openjdk is that it contains more than the JRE, and
    actually has the compilers and debuggers for developing applications. I
    am not trying to develop applications, but just to run one, so the JDK
    should be overkill compared to just having the JRE.

    Now since I already have openJDK 7 and openJDK 8 both on my computer, I
    should be able to just somehow point thinkorswim to run openJDK 7
    instead of 8, right? But I have no idea how to do that. Any ideas?


    --
    G.O.
    Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
    Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
    Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB
    The above is not correct.

    A default openJDK install will contain only a JRE and nothing more.
    This is because of its inability to distribute the compiler parts that are proprietary.

    If you're running openJDK and need to compile, it's possible to build the compiler parts yourself (because you can download the required source separately) but most people instead just install the Oracle JDK instead which is not only easier to acquire the needed functions but is more certain of results.

    The JDK contains much more than "just" compilers, this thread is one example where the JDK also has extensions which may be required for some apps.

    TSU

  8. #8
    Join Date
    Apr 2012
    Location
    Philippines
    Posts
    218

    Default Re: assign default java for TOS

    On 02/14/2015 06:46 PM, tsu2 wrote:

    >
    > I recommend you just switch to JDK 7 whenever you need to, or leave that
    > as the default since even today most Java apps don't require JDK 8...
    > yet.
    >
    > In other words, switch your entire system as needed.
    > It gets a little trickier to assign the Java HOME variable to specific
    > apps and may not be possible using update-alternatives.
    >
    > TSU
    >

    Ok, great. I ended up writing a script that runs the update alternatives
    before executing the TOS application, and then runs it again when I exit
    so that I can switch to Oracle JDK 7 at that time.

    It is a bit of a workaround, but it works, and it is preferable to
    having to run the application in Windows inside VirtualBox.

    Thanks again for your help, I am very glad to have gotten this running now!

    >



    --
    G.O.
    Box #1: 13.1 | KDE 4.12 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 13.1 | KDE 4.12 | AMD Athlon X3 | 64 | 4GB
    Laptop #1: 13.1 | KDE 4.12 | Core i7-2620M | 64 | 8GB
    Laptop #2: 13.2 | KDE 4.14 | Core i7-4710HQ | 64 | 16GB

  9. #9

    Default Re: assign default java for TOS

    Hi everyone,

    I came back with a working solution to run TOS without changing the current java installation. I just installed the requested java version, e.g 1.7 and modified
    the test directory name in the thinkorswim script.

    1) I downloaded the 1.7 version from here: http://www.oracle.com/technetwork/ja...s-1880260.html
    2) extract the jdk directory. I put it in the /tmp directory as I don't delete the contents there but can be installed anywhere.
    3) edit the bash file "thinkorswim" and search the procedure "test_jvm()" and change it like this:

    test_jvm() {
    tested_jvm=na
    test_dir=/tmp/jdk1.7.0_79
    #test_dir=$1
    bin_dir=$test_dir/bin
    java_exc=$bin_dir/java

    ....
    }

    The TOS platform will launch smoothly.

    Best,

    Farid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •