SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2003
    Location
    blore
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy How to call Java Methods inside javascript

    I'm trying to call a java method inside JavaScript.
    The core constructors or methods could be used whereas a user-defined method couldnt be.

    This works --> "var temp = new Packages.java.lang.Long(10); document.writeln(temp);"

    But the following doesnt work --> " var tmp = new Packages.myclasses.myconstructor(); "
    where "myconstructor" is an own class inside package "myclasses"

    Can anyone help me in setting the classpath correctly to the user-defined classes in this case.
    Waiting eagerly for a reply,
    regards
    Summiboy

  2. #2
    ********* Janitor levik's Avatar
    Join Date
    Jan 2003
    Location
    New York
    Posts
    885
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure you can do it that way - the browser's Java plugin would probably be limited to only the core classes that ship with a particular VM - for security reasons.

    Even if you managed to somehow alter this locally (I would guess you could inject your own classes into the system jar file of the JRE your browser's plugin references), I am fairly certain it would not work for other web users.

  3. #3
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    CA
    Posts
    210
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I imagine that you can't alter the classpath from within javascript, but who knows. Anyway if you require your user to have jvm enabled in the first place why not just develop an applet rather than use jscript?
    -ChaCha


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •