[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Problems with Java Applet and JOGL

Asked by mwarble in Java Native Interface (JNI), New to Java Programming, Java Programming Language

Tags: Java, Any, applet jogl

All,
I am trying to get JOGL to work with an applet and I am exasperated.  I'll say up front for reasons I won't explain I do not want to use the JNLP Launcher.  I just want to use a plain old signed applet with the normal HTML tags.  I have spent many hours on this problem and have taken several routes and still haven't succeeded.  Here's where I am in the process and the approach I'm taking.

1.  Launch a signed applet via HTML with your standard applet tag.
2.  To the best of my knowledge, because System.load and System.loadLibrary will only load a library from a local drive not over a network using a URL, I download the required library files (jogl.dll, jogl_awt.dll, jogl_cg.dll, and gluegen-rt.dll) by copying the files from the webserver to a local drive on the end user's machine.  Currently I am using the java.io.tmp property as the local directory.  This seems to work fine.
3.  I then use System.load to load the libraries from java.io.tmp.  This seems to work fine.  No exceptions.
4. Steps 3 and 4 are done in AccessController doPriviedged block to satisfy the security requirements.

Here's the problem.

5.  When the code that actually uses the librairies is executed, it tries to reload the libraries from java.library.path.  Of course the library files aren't there, because they are in java.io.tmp, and an exception is thrown.

So here's my questions/comments:

1.  Does anybody know why the system would try to reload the libraries when they have already been loaded?
2. It seems pretty conclusive that java.library.path cannot be changed at runtime, so that isn't an option. Correct me if I'm wrong.
3. I've tried to copy the files to java.library.path, but that is a list of directories, most which require special permision to write to.  That doesn't seem to be an option. Correct me if I'm wrong.

I am out of ideas on this, so any input would be greatly appreciated.

I'll attach a short code snippet that shows how I'm loading the libraries.

Thanks,
M. Warble

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
AccessController.doPrivileged(new PrivilegedAction() 
{
   public Object run() 
   {
      try
      {		       			
          String lib = System.getProperty("java.io.tmpdir");
          copyFile("http://www.mydomain.com/" + System.mapLibraryName("jogl"), lib + System.mapLibraryName("jogl"));
          copyFile("http://www.mydomain.com/" + System.mapLibraryName("jogl_awt"), lib + System.mapLibraryName("jogl_awt"));
          copyFile("http://www.mydomain.com/" + System.mapLibraryName("jogl_cg"), lib + System.mapLibraryName("jogl_cg"));
          copyFile("http://www.mydomain.com/" + System.mapLibraryName("gluegen-rt"), lib + System.mapLibraryName("gluegen-rt"));
		       			
           System.load(lib + System.mapLibraryName("jogl"));
           System.load(lib + System.mapLibraryName("jogl_awt"));
           System.load(lib + System.mapLibraryName("gluegen-rt"));
	
	// code that uses libraries        	   
           wwd = new WorldWindowGLJPanel();
[+][-]11/27/08 07:46 PM, ID: 23053615Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Java Native Interface (JNI), New to Java Programming, Java Programming Language
Tags: Java, Any, applet jogl
Sign Up Now!
Solution Provided By: samikoivu
Participating Experts: 1
Solution Grade: A
 
[+][-]01/05/09 08:57 AM, ID: 23296902Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_2_20070628