Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java in Java

Reply
Thread Tools

Java in Java

 
 
Dirk Bruere at NeoPax
Guest
Posts: n/a
 
      05-08-2009
Is it possible to download a Java app (applet etc?) and run it inside a
desktop Java app?

--
Dirk

http://www.transcendence.me.uk/ - Transcendence UK
http://www.theconsensus.org/ - A UK political party
http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff
 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      05-08-2009
Dirk Bruere at NeoPax wrote:
> Is it possible to download a Java app (applet etc?) and run it inside a
> desktop Java app?
>

Quite likely, but you won't necessarily get the same security model,
unless you were careful about it.

--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
 
Reply With Quote
 
 
 
 
Mark Space
Guest
Posts: n/a
 
      05-08-2009
Dirk Bruere at NeoPax wrote:
> Is it possible to download a Java app (applet etc?) and run it inside a
> desktop Java app?
>



Yes, you can just download the code and run it. There are Jar classes
for manipulating this.

<http://java.sun.com/javase/6/docs/api/java/util/jar/JarFile.html>

You may need to use a Classloader as well, I haven't actually tried this.


 
Reply With Quote
 
Mark Space
Guest
Posts: n/a
 
      05-08-2009
Mark Space wrote:
> Dirk Bruere at NeoPax wrote:
>> Is it possible to download a Java app (applet etc?) and run it inside
>> a desktop Java app?
>>

>
>
> Yes, you can just download the code and run it. There are Jar classes
> for manipulating this.
>
> <http://java.sun.com/javase/6/docs/api/java/util/jar/JarFile.html>
>
> You may need to use a Classloader as well, I haven't actually tried this.
>
>


Take a look here and the next page in this series. It might help:

<http://java.sun.com/docs/books/tutorial/deployment/jar/jarclassloader.html>
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      05-08-2009
On Fri, 08 May 2009 14:03:53 +0100, Dirk Bruere at NeoPax
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>Is it possible to download a Java app (applet etc?) and run it inside a
>desktop Java app?


Very easy. All you need is Class.forName

See http://mindprod.com/jgloss/classforname.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Species evolve exactly as if they were adapting as best they could to a changing world, and not at all as if they were moving toward a set goal."
~ George Gaylord Simpson
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      05-08-2009
On Fri, 08 May 2009 14:03:53 +0100, Dirk Bruere at NeoPax
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>Is it possible to download a Java app (applet etc?) and run it inside a
>desktop Java app?


It is easy if there is some cooperation, the add on implements an
interface. Harder if not. Then you need reflection.

See http://mindprod.com/jgloss/reflection.html
--
Roedy Green Canadian Mind Products
http://mindprod.com

"Species evolve exactly as if they were adapting as best they could to a changing world, and not at all as if they were moving toward a set goal."
~ George Gaylord Simpson
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-08-2009
Dirk Bruere at NeoPax wrote:
> Is it possible to download a Java app (applet etc?) and run it inside a
> desktop Java app?


Sure.

That is what Andrew does in http://pscode.org/appleteer/ !

Arne
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-08-2009
Roedy Green wrote:
> On Fri, 08 May 2009 14:03:53 +0100, Dirk Bruere at NeoPax
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
> said :
>> Is it possible to download a Java app (applet etc?) and run it inside a
>> desktop Java app?

>
> It is easy if there is some cooperation, the add on implements an
> interface. Harder if not.


Given that apps has a static main method and applets extend either
Applet or JApplet, then an interface should not be needed.

Arne
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-09-2009
On May 9, 8:28*am, Arne Vajhøj <(E-Mail Removed)> wrote:
> Dirk Bruere at NeoPax wrote:
>
> > Is it possible to download a Java app (applet etc?) and run it inside a
> > desktop Java app?

>
> Sure.
>
> That is what Andrew does in http://pscode.org/appleteer/ !


Yep.

To the OP: Note that AppletViewer is also a 'Java desktop
app.', and is what Sun uses to launch webstart based applets,
and the new 'draggable applets' if they are dragged off the
web page.

(whispers) Appleteer is better, though.

--
Andrew T.
pscode.org
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-09-2009
On May 8, 11:03*pm, Dirk Bruere at NeoPax <(E-Mail Removed)>
wrote:
> Is it possible to download a Java app (applet etc?) and run it inside a
> desktop Java app?


For the first part, get an URLClassLoader that
points to the applet.

Here is a simplistic* SSCCE that does the second part.
<http://forums.sun.com/thread.jspa?messageID=10259860#10259860>

* Trouble starts if the applet uses parameters,
does not have a preferred size, uses any of the
applet context methods..

I am a bit confused by your use of 'Java app (applet
etc?)' what else besides an applet are you looking to
run?

--
Andrew T.
pscode.org
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hot Requirements: 1.Sr Java Developer,2.Java Developer (Java with EJB) Isaac Java 0 01-20-2011 08:41 PM
hey i am just started java,, can anyone tell me the use ,application, why java , importance of java.. manish sahu Java 3 02-14-2008 12:00 AM
[JAVA] [EVALUATION] - The Java Failure (Sorry: The Java(tm) Failure) Ilias Lazaridis Java 0 02-01-2005 10:32 AM
JAVA VIRTUAL MUCHINE OR SUN JAVA Fernando Kohan Firefox 1 11-14-2004 02:04 AM
Job to convert Java App 1.3.1 to Java Newest of Java Michael Kintner Java 0 11-30-2003 04:42 AM



Advertisments