maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   JAVA on the N900 is possible! (https://talk.maemo.org/showthread.php?t=37405)

mankir 2009-12-16 13:01

JAVA on the N900 is possible!
 
It worked fine for me to install java (through apt-get netbeans from debian/lenny) after repartitioning the N900. I'm able to compile and run (javac/java) JAVA- (.class-)files now on my device.

steady 2009-12-16 13:04

Re: JAVA on the N900 is possible!
 
Do that mean i can maybe someday play Java based games with N900?

jwi 2009-12-16 13:08

Re: JAVA on the N900 is possible!
 
Isn it just possible to install only JDK without netbeans using atp-get?

thorbo 2009-12-16 13:09

Re: JAVA on the N900 is possible!
 
What is the performance like? The N800 would run Java apps, too... but they were really, really slow (unless in easy-debian, for example).

naabi 2009-12-16 13:10

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by steady (Post 430351)
Do that mean i can maybe someday play Java based games with N900?

That depends. I guess OP is talking about J2SE environment which is quite different from J2ME that can be found from mobile phones. All the mobile phone games use J2ME. Applets etc. use J2SE, but that might be too heavy for N900.

SubCore 2009-12-16 13:12

Re: JAVA on the N900 is possible!
 
@steady

you probably need Java ME for the kind of games you mean - MIDlets for other mobile devices use this.
what mankir installed was a Java SE environment, which is intended for desktop applications. though there are a few webgames out there which need java SE, so it depends on what kind of games you're talking about.


could a moderator please merge this into the main java thread? TIA

TA-t3 2009-12-16 13:38

Re: JAVA on the N900 is possible!
 
Applets is the only thing I would need Java for (some sites use this for authentication). So I guess that means SE is for me then and ME is out.

naabi 2009-12-16 13:40

Re: JAVA on the N900 is possible!
 
I wouldn't hold my breath waiting for browsers to support Java.

cenwesi 2009-12-16 14:26

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by mankir (Post 430348)
It worked fine for me to install java (through apt-get netbeans from debian/lenny) after repartitioning the N900. I'm able to compile and run (javac/java) JAVA- (.class-)files now on my device.

Care to share with us the steps you used to accomplish this. There is a software i need to try and run on this n900 it is called SageTv Placeshifter for HTPC stuff.

khak 2009-12-16 14:30

Re: JAVA on the N900 is possible!
 
@mankir, how to do this ? step by step ? please...

mankir 2009-12-16 16:55

Re: JAVA on the N900 is possible!
 
I followed the steps on page 6 in: Repartition the internal drive, but without the /opt partition. then selected ftp.debian.org/debian lenny as apt-source with: main non-free contrib and there you go...

cenwesi 2009-12-16 17:23

Re: JAVA on the N900 is possible!
 
i am seriously thinking about repartitioning. Was waiting to see when Nokia will release firmware...

Dak 2009-12-16 18:53

Re: JAVA on the N900 is possible!
 
Confirmed.

I downloaded the Sun Java SE for Embedded (ARMv6 jre 1.6_10 Headful)

Download it here

Just inflate the tar.gz on your PC and use "scp -r" to copy it to your N900. Stick a "ln -s" symlink in your /usr/local/bin (may need to edit your path in /etc/profile)

Used Netbeans to build a little swing gui test application. Copied the jarfile across, runs just fine.

It's only a 90-day evaluation jre, sadly...

Dak 2009-12-16 19:02

Re: JAVA on the N900 is possible!
 
I see that Sun requires royalties for embedded jre deployment on anything other than "general purpose" devices. The N900 is most certainly a general purpose computer, just like my linux PC, which we do not pay royalties for.

I have put this question to Sun. Will report back.

Dak 2009-12-16 19:28

Re: JAVA on the N900 is possible!
 
Here I am, using a simple java app to browse my N900 filesystem - this is my jre folder in /home/opt/java/jre

http://i50.tinypic.com/33wpp8w.png

cenwesi 2009-12-16 20:43

Re: JAVA on the N900 is possible!
 
will anyone of you be willing to see if this java app for HTPC will work with that your java. It is called PlaceShifter by sagetv.

Diavoli 2009-12-16 20:54

Re: JAVA on the N900 is possible!
 
WOW, Ok guys please please will this work on playing Ninja Video? Streaming? Please someone find this out. It would be much appreciated thanks!

Dak 2009-12-16 22:00

Re: JAVA on the N900 is possible!
 
@cenwesi - I got your PlaceShifter app running. Don't get too excited yet...it seems to use a bunch of native x86 shared libs, so there will probably be a loud bang when JNI tries to load them.

To test it, I need an example server to connect to....can you point me at one?

http://i48.tinypic.com/2cnutqg.png

cenwesi 2009-12-16 22:04

Re: JAVA on the N900 is possible!
 
omg...no way. It looks like it will work. once i get home i will create an account for you and give u access to see if u can pull up my recordings and movies :)

Xizor 2009-12-17 08:16

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Dak (Post 430791)

Just inflate the tar.gz on your PC and use "scp -r" to copy it to your N900. Stick a "ln -s" symlink in your /usr/local/bin (may need to edit your path in /etc/profile)

Hi!

Could you clarify this a bit....I'm a total n00b when it comes to Linux. :o

hani1400 2009-12-17 08:23

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Xizor (Post 431523)
Hi!

Could you clarify this a bit....I'm a total n00b when it comes to Linux. :o

Yes clarify this a bit more for us linux noobs :D

kevloral 2009-12-17 12:58

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Dak (Post 430791)
It's only a 90-day evaluation jre, sadly...

But does the JRE really stop working after 90 days? Or is it only the license stating that you shouldn't use it after that time?

Bratag 2009-12-17 15:32

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by kevloral (Post 431808)
But does the JRE really stop working after 90 days? Or is it only the license stating that you shouldn't use it after that time?

Quote:

The Java SE for Embedded 6 releases are intended solely for evaluation purposes and will time out in 90 days. The software is free for development but requires a license and small royalty fee to redistribute as part of an embedded product. Please contact us for more information or to request the latest official release.
Thats what It says - does mention timing out after 90 days.

Dak 2009-12-17 16:27

Re: JAVA on the N900 is possible!
 
OK n00bz...listen up ;)

The downloaded file is a gzipped tar (.tar.gz) archive. It's just a different kinda zipfile...it uses a different process for storing and compressing data, but conceptually they're similar.

I don't have a utility on my N900 to open these yet, so I downloaded it onto my PC. I run Fedora linux, which automatically fires up an archive manager when I dbl-click the file. There are free Windows utilities to handle these files too (try tucows.com).

When you expand (extract, inflate...whatever) this file, it will create a folder called "ejre1.6.0_10" and neatly store all the java software within.

All you need to do is use the "scp" command (Secure CoPy via SSH) with the "-r" option to recursively copy the folder and all its contents to your N900.

You'll need your N900s IP address - there's a very handy little widget for that (thanks to whoever made it!)

example:

scp -r ejre1.6.0_10 root@my.n900.ip.addr:/home/opt/java

(you'll need to create that java folder on your N900 first - go to xterm, use "sudo gainroot" and then type "mkdir /home/opt/java")

Once you get this far, we'll continue the lesson :)

Rob1n 2009-12-17 16:36

Re: JAVA on the N900 is possible!
 
I'm not sure you're helping there - most n00bz won't have ssh server installed & configured on their N900!

You'd be better copying the archive straight onto the N900 (connect via USB and choose mass storage mode, copy the file over, then disconnect). Open up an X Terminal, then do:
Code:

sudo gainroot
cd /opt
tar xzf /home/user/MyDocs/*.tar.gz


SubCore 2009-12-17 16:38

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Dak (Post 432083)
All you need to do is use the "scp" command (Secure CoPy via SSH) with the "-r" option to recursively copy the folder and all its contents to your N900.

this requires an OpenSSH daemon running on the N900. If you don' know what that means or don't want to install yet another application, you can just copy the ejre folder with the (windows) GUI onto the tablet, and use XTerminal to move it from /home/user/MyDocs/ejre to /opt

the command(s) would look like this:

Code:

sudo gainroot
mkdir /opt/java
cd /home/user/MyDocs
mv ejre1.6.0_10 /opt/java



i'm sorry i forgot that mydocs is of course a vfat and will loose needed executable flags.
the above is wrong, do this instead:
copy the .tar.gz (or .tgz, haven't d/l it yet) on the n900, then
Code:

sudo gainroot
cd /home/opt/java
tar -xzvf /home/user/MyDocs/<filename>.tar.gz

btw, /home/opt and /opt are the same.

cenwesi 2009-12-17 16:48

Re: JAVA on the N900 is possible!
 
thanks... will forward this to the SageTV company...hopefully they can do this for me and others :)

Xizor 2009-12-17 16:58

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Dak (Post 432083)
OK n00bz...listen up ;)

....

Once you get this far, we'll continue the lesson :)

Ok, I'm ready for the next part of this lesson. :)

Dak 2009-12-17 17:12

Re: JAVA on the N900 is possible!
 
Next, you'll need to install a link to the main java program, so that when you open an xterm and type "java" it knows what you're talking about.

If you've followed my choice of folder location, the java program is located in /home/opt/java/ejre1.6.0_10/bin/java

Open an xterm and use "sudo gainroot" again.

Then type "ln -s /home/opt/java/ejre1.6.0_10/bin/java /usr/local/bin/java"

This will create a "symlink" (a Symbolic Link....basically a pointer to a file or folder) in /usr/local/bin. You could create it in /usr/bin, but I prefer to keep things separate.

You will also need to alter your /etc/profile file slightly. Open it up (with vi)

vi /etc/profile

...and look at the line beginning with "export PATH="

You need to add ":/usr/local/bin" to the end of the path (inside the quotes).

Now you will be able to download Java SE jarfiles and run them by typing "java -jar somejarfile.jar"

I'm working on registering the ".jar" extension so that you can just dbl-click them to run them....I thought I had it figured out, but it's not working yet.

Xizor 2009-12-17 18:05

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Dak (Post 432140)
Next, you'll need to install a link to the main java program, so that when you open an xterm and type "java" it knows what you're talking about.

...

I'm working on registering the ".jar" extension so that you can just dbl-click them to run them....I thought I had it figured out, but it's not working yet.

Hmm, I did as you instructed, but when I open xterm and type "sudo gainroot" followed by "java -jar test.jar" I get:

/bin/sh: java: not found

or did I mess something up. :o

(when I try "java" without "sudo gainroot" I get "permission denied" but that is to be expected?)

Even if I go directly to /home/opt/java/ejre1.6.0_10/bin and type "java" I get "/bin.sh: java: not found"

SubCore 2009-12-17 18:57

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Xizor (Post 432193)
Even if I go directly to /home/opt/java/ejre1.6.0_10/bin and type "java" I get "/bin.sh: java: not found"

when you're in /home/opt/java/ejre1.6.0_10/bin, did you type just "java" or "./java" ? note the dot and the slash at the beginning.
unlike windows, linux shells usually don't have the current path in the PATH variable.

Xizor 2009-12-17 19:37

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by SubCore (Post 432273)
when you're in /home/opt/java/ejre1.6.0_10/bin, did you type just "java" or "./java" ? note the dot and the slash at the beginning.
unlike windows, linux shells usually don't have the current path in the PATH variable.

If I'm in /home/opt/java/ejre1.6.0_10/bin and type "./java" I get "permission denied" ? (And this happens as root )

Quote:

Originally Posted by Dak (Post 432290)
I think you also have to kill and restart your xterm so the new profile path gets refreshed...you can test this by just typing "ja" then hitting tab...it should autocomplete to "java"

The autocomplete works with java but only without "sudo gainroot".

There's got to be some silly mistake I've made, but I just can't seem to figure it out... :(

fabolousv 2009-12-17 19:41

Re: JAVA on the N900 is possible!
 
can someone try nav4all? this might enable turn-by-turn navigation on the n900

Diavoli 2009-12-17 19:47

Re: JAVA on the N900 is possible!
 
Sorry I thought NinjaVideo.net had a java applet that you need to launch first in order to watch the streaming content on there????

Dak 2009-12-17 19:51

Re: JAVA on the N900 is possible!
 
@Xizor - Did you download the archive onto a Windows PC, expand it, then copy it across? If so, you may have lost permissions...

Type "ls -al /home/opt/java/ejre1.6.0_10/bin" into an xterm

On the left-hand side, you should see a column of permission data ("r", "w", "d" etc) ... the files should all have "-rwxr-xr-x" for their permissions.

SubCore 2009-12-17 19:53

Re: JAVA on the N900 is possible!
 
Quote:

Originally Posted by Xizor (Post 432329)
If I'm in /home/opt/java/ejre1.6.0_10/bin and type "./java" I get "permission denied" ? (And this happens as root )

ah, of course.

because you extracted it under windows and copied it to MyDocs first, the executable flags were lost. MyDocs is a vfat partition and doesn't support executable flags.

my suggestion to just copy the extracted content over wasn't so good after all.

you better delete the folder ejre1.6.0_10 (run "rm -rf ejre1.6.0_10" as root when in the directory /home/opt/java) and do this instead:

copy the .tar.gz (or .tgz, haven't d/l it yet) on the n900, then
Code:

sudo gainroot
cd /home/opt/java
tar -xzvf /home/user/MyDocs/<filename>.tar.gz

now every file should have their proper flags and permissions :)

the changes in /etc/profile and the symlink won't be affected if you just delete the folder btw, so you don't have to do that again :)

Xizor 2009-12-17 20:37

Re: JAVA on the N900 is possible!
 
Thank you both SubCore and Dak for the help! Now it's working. :)

Although I don't seem to be able to run even the simplest Swing- app => The ever annoying HeadlessException appears. :(

Dak, could you post the sample Java code for the Java Swing app you used for testing this rte?

qole 2009-12-17 20:43

Re: JAVA on the N900 is possible!
 
Thanks for the instructions, Dak!

Just a note, the N900 has tar with gzip on it. So you can "tar xzvf" on your device without a problem. It avoids the permissions problems of the other methods.

Also /home/user/opt is also just /opt so you can shorten your path a bit.

Is there a specific reason why you choose /usr/local/bin for your symlink, instead of /usr/bin? Wouldn't it be easier to just add it to /usr/bin?

Dak 2009-12-17 20:53

Re: JAVA on the N900 is possible!
 
I tend to leave /usr/bin for "system" kinda stuff, and put all my personal meddling into /usr/local/bin

It's just the way I like to keep my hackery separate, that's all.

qole 2009-12-17 21:29

Re: JAVA on the N900 is possible!
 
Wow.

The headful Java works amazingly well.

I tried the Java 2D demo, and it worked at a reasonable speed! Not as fast as my desktop, but I didn't say, "oh man, this is slow" or anything...

If Sun will let N900 owners use this without trial limitations, then we really do have a viable Java SE for the N900.

Now to try Opera Mini via MicroEmulator ;)

(EDIT: Using this method)


All times are GMT. The time now is 09:06.

vBulletin® Version 3.8.8