Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #15084 > unrolled thread

java and stud libraries

Started byOlve <Olve@nowhere.wd.invalid>
First post2012-06-06 09:13 +0200
Last post2012-06-13 12:27 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  java and stud libraries Olve <Olve@nowhere.wd.invalid> - 2012-06-06 09:13 +0200
    Re: java and stud libraries Roedy Green <see_website@mindprod.com.invalid> - 2012-06-06 19:49 -0700
    Re: java and stud libraries Roedy Green <see_website@mindprod.com.invalid> - 2012-06-13 12:27 -0700

#15084 — java and stud libraries

FromOlve <Olve@nowhere.wd.invalid>
Date2012-06-06 09:13 +0200
Subjectjava and stud libraries
Message-ID<4fcf0317$0$1698$426a74cc@news.free.fr>
Dear all,

   I have some problem with a java wrapper around C library, when this 
wrapper is used inside firefox. It simple doesn't run, though it does if 
I don't use a navigator.

This problem occurs on a single machine, but thinking about I discovered 
there were more potentials problems. I thought that java was bundling 
the code and sending it to the host machine. Which may be somewhat 
difficut since the host computer may be in 64 bits and with different 
specifications. So I thought that the wrapper was sent and you needed to 
tell the user to install the proper C-library.

   I not able to find any litterature on this issue.

   The precise problem: the library I'm interested in is lpsolve55.
The following script works nicely
-----------------------------------------------------------------
import lpsolve.*;

public class Demo {
   public static void main(String[] args) {
     try {
       LpSolve solver = LpSolve.makeLp(0, 4);
       solver.strAddConstraint("3 2 2 1", LpSolve.LE, 4);
       solver.strAddConstraint("0 4 3 1", LpSolve.GE, 3);
       solver.strSetObjFn("2 3 -2 3");
       solver.solve();
       System.out.println("Value of OF: " + solver.getObjective());
       double[] var = solver.getPtrVariables();
       for (int i = 0; i < var.length; i++) {
         System.out.println("Value of var[" + i + "] = " + var[i]);
       }
       solver.deleteLp();
    }
     catch (LpSolveException e) {
        e.printStackTrace();}}
}
------------------------------------------------------------------------
But the java script loaded by an applet blocks
------
    try{
      cU.Alert("Testing...");
      LpSolve mylp = LpSolve.makeLp(0, 4);
      cU.Alert("In FaisableEnRationnelsPositifs ... ");
    } catch (LpSolveException lpse){
        cU.Alert("Exception in FaisableEnRationnelsPositifs!!");
        lpse.printStackTrace();
    }
------------------------------------------
cU.Alert is something like the alert of javascript.
I get a "Testing..." and then nothing.

ldconfig has been run, liblpsolve55.so is inside /usr/lib/ and
/usr/lib/lp_solve/.

Any help welcome!
Best,
Amities,
          Olivier

[toc] | [next] | [standalone]


#15088

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-06-06 19:49 -0700
Message-ID<cj50t79uekr68a6i0e59c0q5kgltr2ncq9@4ax.com>
In reply to#15084
On Wed, 06 Jun 2012 09:13:27 +0200, Olve <Olve@nowhere.wd.invalid>
wrote, quoted or indirectly quoted someone who said :

>This problem occurs on a single machine, but thinking about I discovered 
>there were more potentials problems. I thought that java was bundling 
>the code and sending it to the host machine. Which may be somewhat 
>difficut since the host computer may be in 64 bits and with different 
>specifications. So I thought that the wrapper was sent and you needed to 
>tell the user to install the proper C-library.

Try running Wassup inside your browser.  Then make sure the various
properties are suitable for your code e.g. path to the dll.

see http://mindprod.com/products1.html#WASSUP
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Controlling complexity is the essence of computer programming.
~ Brian W. Kernighan 1942-01-01
.

[toc] | [prev] | [next] | [standalone]


#15250

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-06-13 12:27 -0700
Message-ID<n3qht71o0elmhhr199ad6ss8e59la529cn@4ax.com>
In reply to#15084
On Wed, 06 Jun 2012 09:13:27 +0200, Olve <Olve@nowhere.wd.invalid>
wrote, quoted or indirectly quoted someone who said :

>   I have some problem with a java wrapper around C library, when this 
>wrapper is used inside firefox. It simple doesn't run, though it does if 
>I don't use a navigator.

I am not familiar with the term "a navigator".

Running C code in an Applet is very very difficult because you must
arrange for it to be installed on the library path before the Applet
even starts.  You must also arrange to load either the 32 or 64 bit
version of the code depending on the browser and JVM.

See http://mindprod.com/applet/wassup.html
to figure out what you have.

I just about went mad trying to do this years ago with SetClock.
see http://mindprod.com/applet/setclock.html 
Just to add to the fun, every browser had its own proprietary tricks.

It is much easier to use Java Web Start. Then the run time
automatically installs the dll, selects the correct dll without you
having to do anything more than write a few lines in a *.jnlp file.

Your app runs outside the meddling browser, so if it works on one
machine, it will work on others.

see http://mindprod.com/jgloss/javawebstart.html
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Controlling complexity is the essence of computer programming.
~ Brian W. Kernighan 1942-01-01
.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web