• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to write a script in java

 
shaharyar khan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi dudes
please anyone tell me that how to write a script in java. with any good , understanable and coded example...
thanks in advance to my great helpers
 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shaharyar khan wrote:please anyone tell me that how to write a script in java. with any good , understanable and coded example...

If you mean a dynamic late-binding script that doesn't need compiling: not possible. You should probably look at JavaScript.

It is possible to write a Java program that can read some scripts and execute their code using the javax.ScriptEngine interface, but a working example for anything more than "Hello world" would take a lot of space. I suggest you read the tutorial.

Winston
 
shaharyar khan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks winston.let me clear you something that some one given me a task. which is not clear to me.
1.please tell me why we use script?
and also tell me please what is the difference late binding script (as you told) and other script.
2. the assignment is to read a file and write it in another (.owl extension file) through script
if possible please give me your personal email adress as i want to communicate with you directly on mail.
thanks
 
John Jai
Rancher
Posts: 1776
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shaharyar khan wrote:
2. the assignment is to read a file and write it in another (.owl extension file) through script
if possible please give me your personal email adress as i want to communicate with you directly on mail.
thanks

Is that a assignment you want to accomplish using script... else it's just a file copy which is easier to code...
And please UseTheForumNotEmail... I would learn something reading the posts
 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
Eclipse IDE Hibernate Ubuntu
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shaharyar khan wrote:1.please tell me why we use script?
and also tell me please what is the difference late binding script (as you told) and other script.

None. Most scripting languages are late-binding because they are usually interpreted, not compiled. This allows them to evaluate things such as strings, variables and files containiing scripting commands at runtime, rather than going through a static binding process such as a compiler or a linker.

2. the assignment is to read a file and write it in another (.owl extension file) through script

If, as John says, this a merely a file copying exercise, then you probably don't need a scripting interface. If any sort of syntax checking is required, you might; but I've never done it myself, so I don't know if Java provides an OWL interpreter through its scripting interface. There may be 3rd party libraries around that do.

if possible please give me your personal email adress as i want to communicate with you directly on mail.

I'm afraid that goes against forum rules; but if you want to provide some extra detail, I'm sure someone will have an idea that might help.

Winston
 
Matthew Brown
Bartender
Posts: 4567
8
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe were focussing too much on the word "script" here? - I'm not certain it's been used in its technical sense.

So, Shaharyar, can you give us more information about what it is you're trying to do? What you've told us so far is nowhere near enough for someone to help you with it.
 
shaharyar khan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks everyone for considering me. let me ask you the things one by one.
1. please tell me the purpose of writing a automated script ? and what is the link of programming language with the script
 
Winston Gutkowski
Bartender
Pie
Posts: 10422
63
Eclipse IDE Hibernate Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shaharyar khan wrote:thanks everyone for considering me. let me ask you the things one by one.
1. please tell me the purpose of writing a automated script ? and what is the link of programming language with the script

Not sure what you mean by an "automated script". Do you mean one that's run on a scheduler?

The purpose writing a script is the same as it is for any piece of code: you want to automate it (whatever 'it' is).

As for the link between scripts and languages: As I said above, "programming languages" are usually statically compiled and/or linked, scripts are interpreted; but the distinction is getting more blurred these days. Lots of scripts call themselves "scripting languages".

But I think Matthew's right; rather than just firing a bunch of questions, why don't you just explain what it is you want to do?

Winston
 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shaharyar khan wrote:hi dudes
please anyone tell me that how to write a script in java. with any good , understanable and coded example...
thanks in advance to my great helpers

which scripts shell scripts or some other scripts ?
if it is a shell scripts for linux & unix platform then ,
i suggest an alternative make a file and write all the commands you want your script to perform and save it with extension .sh and give it a full rwx permission using java
then using Desktop class try to open that file , in that way you could run your script in unix or linux platforms
 
shaharyar khan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnaks naved momin
your explaination clears me about script and thanks 2 all
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic