java runtime

Discussion in 'Java' started by TK, Apr 5, 2012.

  1. TK

    TK Guest

    Hallo Zusammen,

    Hab unter UBuntu openjdj1.7 und 1.6 installiert. Wenn ich ein Programm
    starte dann läuft es immer mit 1.6 (auf der Konsole). ES soll aber
    mit 1.7 laufen. Wie mache ich das?

    o-o

    Thomas
    TK, Apr 5, 2012
    #1
    1. Advertising

  2. On 05/04/12 12:43, TK wrote:
    > Hab unter UBuntu openjdj1.7 und 1.6 installiert. Wenn ich ein Programm
    > starte dann läuft es immer mit 1.6 (auf der Konsole). ES soll aber
    > mit 1.7 laufen. Wie mache ich das?


    Google translation:
    > 'm On Ubuntu openjdj1.7 and 1.6 installed. If I have a program
    > then start it always runs at 1.6 (on the console). However, it should
    > run with 1.7. How do I do that?


    I've had the same problem - javac is bound to 1.7, while java is bound
    to 1.6. I tried removing the 1.6 packages, but 1.7 depends on them, and
    that got me into a terrible mess.

    IIRC, this worked for me:

    sudo update-alternatives --config java

    ....and then choosing the 1.7 version. I found I had to do this for all
    the commands in java-7-openjdk-*/bin that are symlinks:

    * java
    * keytool
    * orbd
    * pack200
    * policytool
    * rmid
    * rmiregistry
    * servertool
    * tnameserv
    * unpack200

    Hmm, can't seem to find a javaws for 1.7.

    --
    ss at comp dot lancs dot ac dot uk
    Steven Simpson, Apr 5, 2012
    #2
    1. Advertising

  3. Am 05.04.2012 13:43, schrieb TK:

    > Hab unter UBuntu openjdj1.7 und 1.6 installiert. Wenn ich ein Programm
    > starte dann läuft es immer mit 1.6 (auf der Konsole). ES soll aber
    > mit 1.7 laufen. Wie mache ich das?


    Setze im Environment des Programmes, das mit dem JDK laufen soll die
    Variable JAVA_HOME auf den Pfad zum jdk (vmtl. /usr/lib/jdk/jdk-1.7 oder
    ähnlich - was "aktiv" ist erfährst Du mittels "which java" - die andere
    jvm liegt meist "daneben".).

    you@yourhost> export JAVA_HOME=/Pfad/zu/Deinem/JDK
    you@yourhost> ./yourProgram

    oder "flüchtig" nur für den Programmaufruf

    you@yourhost> JAVA_HOME=/Pfad/zu/Deinem/JDK ./yourProgram

    BTW: Group language seems to be english - you'd better change to that ...

    Bye, Volker
    Volker Mueller, Apr 5, 2012
    #3
  4. TK

    Roedy Green Guest

    On Thu, 5 Apr 2012 04:43:21 -0700 (PDT), TK <>
    wrote, quoted or indirectly quoted someone who said :

    >Hallo Zusammen,
    >
    >Hab unter UBuntu openjdj1.7 und 1.6 installiert. Wenn ich ein Programm
    >starte dann l=E4uft es immer mit 1.6 (auf der Konsole). ES soll aber
    >mit 1.7 laufen. Wie mache ich das?


    translation:

    Hi I'm everyone,

    I'm using Ubuntu openjdj1.7 with JDK 1.6 installed. When I start a
    program with l = E4uft ??? it always uses Java 1.6 (on the console).
    However, it should run with 1.7. How can I do that?

    see http://mindprod.com/jgloss/javaexe.html#MULITIPLES

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    When you were a child, if you did your own experiment
    to see if it was better to put to cocoa into your cup first
    or the hot milk first, then you likely have the programmer gene..
    Roedy Green, Apr 6, 2012
    #4
  5. TK

    Roedy Green Guest

    On Thu, 05 Apr 2012 17:57:58 -0700, Roedy Green
    <> wrote, quoted or indirectly quoted
    someone who said :

    >translation:
    >
    >Hi I'm everyone,


    I meant Hi everyone.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com
    When you were a child, if you did your own experiment
    to see if it was better to put to cocoa into your cup first
    or the hot milk first, then you likely have the programmer gene..
    Roedy Green, Apr 6, 2012
    #5
  6. TK

    gauravu

    Joined:
    Apr 13, 2012
    Messages:
    1
    hi,
    I have tried writing a jni call for the simple c code. when i try to install this on the phone running 2.3.3 it doesnt install, sometimes even if it installs then it is being force closed.Please help me with this. the code details are as follows:

    The java code of which i generate the header file.

    package com.hosa;

    public class edgejava{
    static{
    System.loadLibrary("edgejava");
    }
    public native int main();
    }

    the generated header file is as below

    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class com_hosa_edgejava */

    #ifndef _Included_com_hosa_edgejava
    #define _Included_com_hosa_edgejava
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
    * Class: com_hosa_edgejava
    * Method: main
    * Signature: ()I
    */
    JNIEXPORT jint JNICALL Java_com_hosa_edgejava_main
    (JNIEnv *, jobject);

    #ifdef __cplusplus
    }
    #endif
    #endif


    the implementation of native function is as below

    #include "com_hosa_edgejava.h"
    #include <jni.h>
    #include <cv.h>
    #include <highgui.h>

    using namespace cv;

    JNIEXPORT jint JNICALL Java_com_pes_edgejava_main(JNIEnv *, jobject){
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened()) // check if we succeeded
    return -1;

    Mat edges;
    namedWindow("edges",CV_WINDOW_AUTOSIZE);
    for()
    {
    Mat frame;
    cap >> frame; // get a new frame from camera
    cvtColor(frame, edges, CV_BGR2GRAY);
    GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
    Canny(edges, edges, 0, 30, 3);
    imshow("edges", edges);
    if(waitKey(30) >= 0) break;
    }
    // the camera will be deinitialized automatically in VideoCapture destructor
    return 0;
    }

    the android.mk file

    LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    include /home/srijith/android-opencv/OpenCV-2.3.1/share/OpenCV/OpenCV.mk

    LOCAL_MODULE := edgejava
    LOCAL_SRC_FILES := edgecpp.cpp
    LOCAL_LDLIBS += -llog -ldl


    include $(BUILD_SHARED_LIBRARY)


    the application.mk


    APP_MODULES := edgejava
    APP_STL := gnustl_static
    APP_CPPFLAGS := -frtti -fexceptions


    the activity file is as follows

    package com.hosa;

    import android.app.Activity;
    import android.os.Bundle;

    public class Andedge2Activity extends Activity {
    edgejava nativelib;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    nativelib= new edgejava();
    int i=nativelib.main();
    System.out.println("value returned to andedgeactivity "+i);
    }
    }

    All necessary changes to the manifest has been done like mention of use of camera and permissions has been set.
    gauravu, Apr 13, 2012
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lucia
    Replies:
    7
    Views:
    7,641
    vinny503
    Aug 19, 2011
  2. Alex Hunsley

    sun java runtime for AIX?

    Alex Hunsley, Nov 6, 2003, in forum: Java
    Replies:
    5
    Views:
    8,311
    Alex Hunsley
    Nov 6, 2003
  3. seenuvas
    Replies:
    7
    Views:
    2,657
    Roedy Green
    Jan 24, 2006
  4. seenuvas
    Replies:
    0
    Views:
    519
    seenuvas
    Jan 24, 2006
  5. Hal Vaughan
    Replies:
    11
    Views:
    1,105
    Gordon Beaton
    May 22, 2006
Loading...

Share This Page