CarlosTheDwarf Posted July 4, 2008 Share Posted July 4, 2008 I wrote a program in java and now need to integrate it in a browser, and not as a Applet.The program uses other files and I need a way to access them. I tried using AJAX but it didnt work out because i needed methods like next() and nextLIne(). Basically i need a replacement for the Scanner class.Ive tried a lot of things and I dont even know what language i will have to use to do what i want so i figured id post it here and hope for some coding master to come save me Mucho Grascias,Carlos Link to comment Share on other sites More sharing options...
justsomeguy Posted July 5, 2008 Share Posted July 5, 2008 Is all of the code Javascript? Java and Javascript aren't related, you can't import Java code to run in Javascript. If all of the code is Javascript then there are a couple ways to include it. Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 6, 2008 Author Share Posted July 6, 2008 Well I originally wrote the program in Java because that is the language I am most familiar with. But yes all of the code is now in JavaScript. The conversion went smoothly until i could not find anything to function as the Scanner class does. Link to comment Share on other sites More sharing options...
Ingolme Posted July 6, 2008 Share Posted July 6, 2008 I'm not familiar with Java, what exactly does the Scanner class do? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 7, 2008 Share Posted July 7, 2008 Well, if all of the code is in Javascript then you can try a couple different methods to attach the external script files. One way, which I've seen Google use, is to just use a document.write statement within the HTML content. If you run the statement after the page finishes loading you'll have problems, but if it is inline in the HTML code then it will work to attach a new script file. In that case you need to close your first script block and then start another one to use the new code. <script type="text/javascript">document.write("<script src=\"script.js\" type=\"text/javascript\"><" + "/script>");</script><script type="text/javascript">// use the code in script.js here</script> You can also try creating a new script element and attaching it to the head. sc = document.createElement("script");sc.src = "script.js";document.getElementsByTagName("head")[0].appendChild(sc); Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 7, 2008 Author Share Posted July 7, 2008 hmmmm thank you very much ill give it a try....the scanner class enables you to work with files on your computer Link to comment Share on other sites More sharing options...
CarlosTheDwarf Posted July 7, 2008 Author Share Posted July 7, 2008 hmmmm thank you very much ill give it a try....the scanner class enables you to work with files on your computerwell or the keyboard for that matter....it reads data into a program i guess is the best way to sum it up Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.