Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Im having problems compiling a very simple .js file to .exe

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Im having problems compiling a very simple .js file to .exe

    "
    var WindowStyle_Hidden = 0
    var objShell = WScript.CreateObject("WScript.Shell")
    var result = objShell.Run("cmd.exe /c checker.bat", WindowStyle_Hidden)
    "
    this is my code, (i didnt create this code, its on the internet. it works great when you double click on it, but wont compile) basically i want to use this simple java script to start a hidden batch file when the computer starts (running the .exe im trying to compile from the registry, which for some retarted reason wont run it as a .js)
    the error i get from JSC (what im using to try and compile) says:

    myfilename.js (3,16) : error JS1135: Variable 'WScript' has not been declared.

    does anyone know either how to declare that, or compile it or even better help me with a better way to run a hidden batch from the registry when the computer starts. i want it hidden because its annoying to look at every time the computer starts.

    i hope that i have provided enough enformation


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Im having problems compiling a very simple .js file to .exe

    javascript != java The code posted is actually javascript, which isn't compiled but ran (typically) by web browsers. Not sure if you need java or javascript, but if you are interested in java suggest the following: The Java™ Tutorials

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Im having problems compiling a very simple .js file to .exe

    For the most part i understand that. what I would like is to have the registry run a .js file in order to open a hidden batch file to perform tasks in the background. the reason i was investigating compiling a .js file is because it seems that the script will not execute when run from the registry HKEYLOCALSOFt~MICR~WIND~CURR~RUN. <-(hope thats obvious enough) the .js works perfectly fine and does exactly what i want when i double click on it. Really what Im trying to do is find a way launch a hidden batch window from the run key.

  4. #4
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Im having problems compiling a very simple .js file to .exe

    Cool, hope there's another useful info.

Similar Threads

  1. Help with Compiling
    By w.spidey in forum Object Oriented Programming
    Replies: 10
    Last Post: September 9th, 2010, 01:48 PM
  2. compiling a file
    By jkoracle23 in forum Java Theory & Questions
    Replies: 4
    Last Post: June 19th, 2010, 03:20 PM
  3. Problems with File Reader (Strings and 2D Array Storage)
    By K0209 in forum File I/O & Other I/O Streams
    Replies: 44
    Last Post: January 12th, 2010, 10:48 AM
  4. Declaring variables in constructor and compiling
    By Newoor in forum Object Oriented Programming
    Replies: 3
    Last Post: December 5th, 2009, 01:07 PM
  5. Strange Compiling Error
    By crism85 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 13th, 2009, 12:59 AM

Tags for this Thread