Notices


Reply
Thread Tools
antezz's Avatar
Posts: 172 | Thanked: 160 times | Joined on Jan 2010 @ Sweden
#31
It's empty in /usr/local/bin
 
Posts: 124 | Thanked: 213 times | Joined on Dec 2009
#32
I apologize antezz (and everyone else).

I was using a nonstandard location (/usr/local/bin) to install my symlinks. I should be using /usr/bin

I have made the minor change required and uploaded a new .deb

Please uninstall mmjre, go back to the first post, and reinstall with this [hopefully!] final version.
 

The Following 3 Users Say Thank You to Dak For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#33
Originally Posted by Dak View Post
There's also some mime registration stuff in there that doesn't seem to work yet...it doesn't hurt anything else though The idea was that you could just click on a jarfile in your file browser (or create a desktop shortcut to it) and it would automatically launch jarexec for you. I'm sure it's something simple I've overlooked...maybe somebody can cast some fresh eyes over it and tell me my mistake
Sure.

Firstly, you include a XML for the JAR mimetype. This is what you usually do, yes, but not when it's already defined by another file: /usr/share/mime/packages/freedesktop.xml

Your desktop file is installed in the wrong place; it should be installed in /usr/share/applications/hildon/

And its contents replaced with:
Code:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Jarfile
NoDisplay=true
Exec=/usr/local/bin/javalauncher
X-Osso-Service=javalauncher
X-Osso-Type=application/x-executable
MimeType=application/x-jar;
We also need another file, /usr/share/dbus-1/services/javalauncher.service:
Code:
D-BUS Service]
Name=javalauncher
Exec=/usr/local/bin/javalauncher
Why? You're under the assumption that when a mimetype is associated, the program defined in the Exec field of the relevant desktop file will be called, with $1 set to the filename. Not a bad assumption, but this is Maemo

How it works in Maemo is that a "mime_open" method will be called on the application specified in the .service field (the X-Osso-Service field in the desktop file tells Maemo which service file to look for) with an array of file names passed to a handler handling this method in the app; the libosso library has functions that will register your program and allow to add a handler for these messages.

I've attached a "quick-'n'-dirty" launcher written in Vala as its syntax is closer to Java than C's and it doesn't have the overhead of Python. It needs compiling and installation as /usr/local/bin/javalauncher
Attached Files
File Type: tar javalauncher.tar (20.0 KB, 138 views)

Last edited by qwerty12; 2010-05-21 at 21:28.
 

The Following 5 Users Say Thank You to qwerty12 For This Useful Post:
shiny's Avatar
Posts: 147 | Thanked: 53 times | Joined on Dec 2009 @ West London, UK
#34
Originally Posted by torshind View Post
There's libswt-hildon but I don't know if it's complete.
Wonko's hildon SWT port does work out-of-the-box. It did for me, anyway, when trying out my existing SWT applications. Point me in the direction of anything you'd like testing.

I have a blog entry about it.
__________________
Come and say hello at www.shinypixel.co.uk | rikward on Twitter
 

The Following 4 Users Say Thank You to shiny For This Useful Post:
Posts: 124 | Thanked: 213 times | Joined on Dec 2009
#35
OK...thanks to qwerty I reckon I'm getting somewhere

[See attached .tar.gz]

I converted the Vala into a little C prog (main.c)

I included the service and desktop files

Now, when I click on a jarfile in FileManager it no longer asks me what I wish to use to open it with....it just does nothing.

So I ran the javalauncher prog on the cmd line, and I could see that it successfully called osso_initialize and osso_mime_set_cb, but I have no way of knowing if the prog is being successfully called by FileManager/mime_open.

What is the best way to debug this mechanism?
Attached Files
File Type: gz javalauncher.tar.gz (932 Bytes, 113 views)
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#36
Originally Posted by Dak View Post
OK...thanks to qwerty I reckon I'm getting somewhere

[See attached .tar.gz]

I converted the Vala into a little C prog (main.c)
*Cries* - Vala converts to C before building
(Although, blame any stupidities of mine such as checking the suffix on my cold...)

Originally Posted by Dak View Post
I converted the Vala into a little C prog (main.c)

I included the service and desktop files

Now, when I click on a jarfile in FileManager it no longer asks me what I wish to use to open it with....it just does nothing.

So I ran the javalauncher prog on the cmd line, and I could see that it successfully called osso_initialize and osso_mime_set_cb, but I have no way of knowing if the prog is being successfully called by FileManager/mime_open.

What is the best way to debug this mechanism?
In your service file, you call the service "org.maemo.javalauncher", which is fine but you've still left it as "javalauncher" in the desktop file. When a name is not given a prefix, it automatically assumes "com.nokia.javalauncher". So you've got a desktop file looking for com.nokia.javalauncher but a service file only defining org.maemo.javalauncher.
This is also true for osso_initialize(), so the call to that must also be amended.

I verified your program actually starts by doing a - wait for it - "while true; do ps | grep java | grep -v grep; done" from the terminal.

However,
PHP Code:
dbus_connection_flush((DBusConnection*)osso_get_dbus_connection(ctx));
dbus_connection_read_write((DBusConnection*)osso_get_dbus_connection(ctx), 0); 
didn't work for me; mime_cb was never called. Maybe I'm doing it on the wrong DBusConnection, but I dunno.

So I went back to what works for me: A GMainLoop. libosso will automatically call dbus_connection_setup_with_g_main () on both its connections for you, and mime_cb was actually getting called this time. And, according to ltrace, it's sure not waking up as much

Now, the name given will be a URI. javac doesn't understand so I used the g_filename_from_uri function from GLib. Whilst it's tempting to just remove the "file://" prefix, the browser, when "opening a file", will give you a real URI that must be escaped

When doing this, it all worked

PHP Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <libosso.h>
//#include "osso-internal.h"

static charjarexec_cmd "/usr/local/bin/jarexec";

static 
void mime_cb(GMainLoop *loopint argcgchar** argv)
{
  
int cmdlen strlen(jarexec_cmd) + 1;
  
int arglen 0;
  
charcmd NULL;
  
int i 0;
  for (
i=0i<argci++)
  {
    if (
argv[i] != NULL)
    {
      
gchar *cmd_filename NULL;

      
arglen strlen(argv[i]);
      
cmd malloc(cmdlen arglen 1);
      
memset(cmd0x00cmdlen arglen 1);

      
printf(cmd"%s %s\n"jarexec_cmdargv[i]);
      
fflush(stdout);

      
cmd_filename g_filename_from_uri (argv[i], NULLNULL);
      
sprintf(cmd"%s %s"jarexec_cmdcmd_filename);
      
g_free(cmd_filename);

      
//osso_system_note_infoprint () -- would be nice, IMHO

      
system(cmd);
      
free (cmd);
    }
  }
  
  
g_main_loop_quit (loop);
}

int main(int argcchar** argv)
{
  
osso_context_tctx osso_initialize("org.maemo.javalauncher","0.1"0NULL);
  
GMainLoop *loop g_main_loop_new (NULLFALSE);
  if (
ctx != NULL && loop != NULL)
  {
    
printf("javalauncher osso_initialize succeeded\n");
    
printf("\n");
    
fflush(stdout);

    if (
osso_mime_set_cb(ctxmime_cbloop) == OSSO_OK)
    {
      
printf("javalauncher osso_mime_set_cb succeeded\n");
      
fflush(stdout);

      
/* while (jar_running)
      {
        dbus_connection_flush((DBusConnection*)osso_get_dbus_connection(ctx));
        dbus_connection_read_write((DBusConnection*)osso_get_dbus_connection(ctx), 0);
        sleep(1);
      } */
      
g_main_loop_run (loop);
    }
    else
    {
      
printf("javalauncher osso_mime_set_cb failed\n");
      
fflush(stdout);
    }
  }
  else
  {
    
printf("javalauncher osso_initialize failed\n");
    
fflush(stdout);
  }

  return (
EXIT_SUCCESS);

 

The Following 3 Users Say Thank You to qwerty12 For This Useful Post:
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#37
i'm trying to launch one app... it says have a look for evalation period... is it eval?! just to change... microemu is better... iced tea too
 
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#38
90 days eval,,, you gotta write that its eval!? dont be clown... write in the trhead that its evaluation!!
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#39
Originally Posted by santiago View Post
90 days eval,,, you gotta write that its eval!? dont be clown... write in the trhead that its evaluation!!


Originally Posted by Dak View Post
[...]and a convenience script called "jarexec" (which also refreshes the license every time you run it, so your JRE will never expire)
Must beat the limit
 

The Following 6 Users Say Thank You to qwerty12 For This Useful Post:
santiago's Avatar
Posts: 518 | Thanked: 334 times | Joined on Mar 2010 @ italy
#40
everydays not sometimes... its really orrible that write... check for evaluatio time.... can u remove it?!
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:23.