Trying to add Javascript.component to OSA (Applescript Editor)

Discussion in 'Mac Programming' started by BuddyHax, Jul 12, 2011.

  1. BuddyHax macrumors newbie

    BuddyHax

    Joined:
    Feb 4, 2011
    #1
    Hey,

    I recently read a post about installing a Javascript plug-in for Applescript editor. I downloaded the plugin and did what the instructions said for my OS (10.6.8) and then tried to choose Javascript as the default language in Applescript Editor, only one problem, Applescript doesn't seem to realise that I have a plug-in for Javascript, nor does it detect the language anywhere on the computer. I have followed the developers instructions clearly and it doesn't work at all, I will be happy to supply links.

    Please help :(
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    Why not just supply the links? That way at least we know what instructions you've attempt to follow and what JavaScript component you're referring to.
     
  3. BuddyHax thread starter macrumors newbie

    BuddyHax

    Joined:
    Feb 4, 2011
    #3
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Most likely you're on a 64-bit system, and that plugin is 32-bit Intel/PPC so it won't load unless you run AppleScript Editor in 32-bit mode.
     
  5. BuddyHax thread starter macrumors newbie

    BuddyHax

    Joined:
    Feb 4, 2011
    #5
    Ohhhhhh thankyou!! May I ask how I run AppleScript editor in 32 bit mode? :)
     
  6. BuddyHax, Jul 13, 2011
    Last edited by a moderator: Jul 13, 2011

    BuddyHax thread starter macrumors newbie

    BuddyHax

    Joined:
    Feb 4, 2011
    #6
    Ok I figured it out, thankyou for your help, now I just need to ask something about a syntax error I keep getting, I'm just learning Java and I keep getting this error: "Syntax Error: missing name in import statement" the code i'm trying to use is:

    Code:
    import static java.lang.System.out;
    
    class Millionare {
    	public static void main(String args[]) {
    		double amountInAccount;
    			
    		amountInAccount = 50.22;
    		amountInAccount = amountInAccount + 10000000.00
    			
    		out.print("You have $");
    		out.print("amountInAccount");
    		out.println(" in your account.");
    	}
    }
    Hope you can help once again, you've been fanatastic!!
     
  7. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #7
    Isn't the plugin you installed to enable JavaScript? JavaScript is not Java.
     
  8. BuddyHax thread starter macrumors newbie

    BuddyHax

    Joined:
    Feb 4, 2011
    #8
    Hmmmm... well do you have any links to a plug-in which enables java in applescript editor? And when I tried netbeans, it doesn't show an output, just this message in the output window:

    run:
    Exception in thread "main" java.lang.NoClassDefFoundError: Millionare/Main
    Caused by: java.lang.ClassNotFoundException: Millionare.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)

    Any ideas?
     
  9. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #9
    Looks like you have the Main Class in your Netbeans project set incorrectly. Right-click on your project, click properties, click Run, click browse next to Main Class and choose your Millionare (sic) class.
     
  10. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #10
    You need to identify which version of Java you're compiling for.

    The import static feature was only added in Java 5. If your build is targeting something earlier, then that won't compile.
     
  11. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #11
    What is it you think you are going to accomplish by putting Java into the AppleScript Editor? I think you are very confused about something, but don't quite know what it is.
     
  12. BuddyHax thread starter macrumors newbie

    BuddyHax

    Joined:
    Feb 4, 2011
    #12
    For larkost, I am learning Java 6, and I liked Applescript Editor's simple coding plane, it was nice to look at without all the tabs and knobbly bits you get with netbeans and other scripting programs. I would like to thank jiminaus as it worked, and finally after trying everything (I could think of) I actually have a coding program that runs the type of Java I want to learn, Thankyou!!
     
  13. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #13
    If you want a simple programmer's text editor, checked out TextWrangler, it's free. It think it's in the Mac App Store. If not you can download it from http://www.barebones.com/products/textwrangler/
     

Share This Page